[Trac-tickets] [The Trac Project] #2581: Add Paste Deploy support
to the WSGI branch
The Trac Project
noreply at edgewall.com
Tue Jan 10 14:02:00 CST 2006
#2581: Add Paste Deploy support to the WSGI branch
---------------------------------+------------------------------------------
Reporter: ianb at colorstudy.com | Owner: jonas
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: general | Version: devel
Severity: normal | Keywords: wsgi paste
---------------------------------+------------------------------------------
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).
--
Ticket URL: <http://projects.edgewall.com/trac/ticket/2581>
The Trac Project <http://trac.edgewall.com/>
More information about the Trac-Tickets
mailing list