Edgewall Software

Opened 15 years ago

Last modified 5 years ago

#2581 new enhancement

[PATCH] Add Paste Deploy support to the WSGI branch

Reported by: ianb@… Owned by:
Priority: normal Milestone: unscheduled
Component: general Version: devel
Severity: normal Keywords: wsgi paste patch
Cc: ianb@…, Thijs Triemstra Branch:
Release Notes:
API Changes:
Internal Changes:


Attached is a patch (against the sandbox/wsgi branch) that implements a Paste Deploy entry point for trac. Using the sample deployment file (in the patch in docs/sample_deploy.ini) you can do:

paster serve docs/sample_deploy.ini

To get a working server. The configuration in that file just points to the Trac project directory, it doesn't put any of Trac's configuration in that file. The server in the sample is WSGIUtils, but any server can be used (e.g., flup's FastCGI or SCGI servers). The sample file also wraps the app in paste.lint, which checks for WSGI compliance (you wouldn't use this normally, but for testing and development it is useful).

This also changes setup.py to use setuptools, because that is needed for entry points. Strictly speaking this would not be necessary (you can just put paste.app_factory = trac.web.main:paste_app_factory in the deployment configuration instead of use = egg:Trac). But, eh. I'm a little surprised Trac isn't using setuptools already. Just changing the import from distutils.core to setuptools seems to work well enough for me.

Also two bugs are fixed; one when subdirectories of parent_dir are not loadable, and one for parent_dirs itself.

I haven't implemented env_paths in this patch — it would probably mean collecting all the configuration variables and parsing them a bit (but would certainly be doable). I'm not sure what the threadsafety of Trac is, but if dispatch_request could be entered from multiple threads with different trac.env_path values and work that way, other dispatchers (like Paste#urlmap) could be used in addition to env_paths. It looks like Trac is probably already ready to be used like this (if it doesn't use globals to communicate configuration).

Attachments (1)

paste-deploy.patch (3.6 KB ) - added by ianb@… 15 years ago.

Download all attachments as: .zip

Change History (11)

by ianb@…, 15 years ago

Attachment: paste-deploy.patch added


comment:1 by Christopher Lenz, 15 years ago

Milestone: 0.10
Owner: changed from Jonas Borgström to Christopher Lenz
Status: newassigned

Integration with Trac is definitely something we'd like to do long-term, however I'm not sure whether we're quite ready to move setup.py to setuptools yet… we have a lot of users on, ehem, rather “convervative" linux distros, where the whole situation around setuptools is somewhat fuzzy at this point.

But anyway, I'll look into the patch. Thanks!

comment:2 by Christopher Lenz, 15 years ago

Doh, I meant “integration with Paste“, of course :-P

comment:3 by ianb@…, 15 years ago

Setuptools 0.6a9 also adds some support for those more conservative linux distros (from feedback from Debian), by allowing installations that look completely normal, but a .egg-info directory is created alongside the package (that contains metadata like entry_points.txt). This is enabled with —single-version-externally-managed

There's also the option of not using entry points, but using paste.app_factory to indicate the entry point explicitly. Paste doesn't have to be the exclusive of any other techniques for starting up the server.

comment:4 by coderanger@…, 14 years ago

Milestone: 0.100.11

The new setuptools branch is not going to be part of 0.10, and this should really wait until that is finalized.

comment:5 by Matthew Good, 13 years ago

#5112 has been marked as a duplicate and mentions the th:TracWsgiPlugin which implements Paste Deploy support for Trac.

comment:6 by Christian Boos, 13 years ago

See also #5586.

comment:7 by Christian Boos, 11 years ago

Milestone: 0.11-retriage2.0

comment:8 by Christian Boos, 10 years ago

Milestone: 2.0unscheduled

Milestone 2.0 deleted

comment:9 by Thijs Triemstra, 10 years ago

Cc: Thijs Triemstra added
Keywords: patch added
Summary: Add Paste Deploy support to the WSGI branch[PATCH] Add Paste Deploy support to the WSGI branch

comment:10 by Ryan J Ollos, 5 years ago

Owner: Christopher Lenz removed
Status: assignednew

Modify Ticket

Change Properties
Set your email in Preferences
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.