Edgewall Software
Home
Trac
Trac Hacks
Genshi
Babel
Bitten
Home
Download
Documentation
Mailing Lists
License
FAQ
Search:
Login
Preferences
Help/Guide
About Trac
Wiki
Timeline
Roadmap
Browse Source
View Tickets
New Ticket
Search
Context Navigation
+0
Start Page
Index
History
Editing ModPython
Adjust edit area height:
8
12
16
20
24
28
32
36
40
Edit side-by-side
= Trac and mod_python = Trac 0.8 and later (not yet released) supports [http://www.modpython.org/ mod_python], which speeds up Trac's response times considerably and permits use of many Apache features not possible with tracd/mod_proxy. == Simple configuration == Here's a typical Trac CGI/Apache setup: {{{ ScriptAlias /trac/myproject /path/to/python/share/trac/cgi-bin/trac.cgi <Location /trac/myproject> SetEnv TRAC_ENV /var/svn/trac/myproject </Location> }}} The equivalent mod_python setup is: {{{ <Location /trac/myproject> SetHandler mod_python PythonHandler trac.ModPythonHandler PythonOption TracEnv /var/svn/trac/myproject </Location> }}} ''Note: you will need to create a real physical {{{trac/}}} directory (name matches the first location path segment from the above example) inside your !DocumentRoot so that Trac can figure out the correct base location. That seems to be a problem (or feature?) with mod_python.'' == Setting up multiple projects == While the Trac mod_python handler does not yet support multiple projects directly, you can configure it so that multiple projects can be hosted, as can be seen in the following simple example: {{{ <LocationMatch /mptrac/[[:alnum:]]+> SetHandler mod_python PythonHandler trac.ModPythonHandler </LocationMatch> <Location /mptrac/trac> PythonOption TracEnv "/var/www/projects/trac" </Location> <Location /mptrac/dwt> PythonOption TracEnv "/var/www/projects/mediatis-dwt" </Location> }}} This sets up two projects. The disadvantage of the approach used here is that you need one additional {{{<Location>}}} directive per Trac instance. There may very well be better ways to accomplish this. '''A word of warning''': Don't be tempted into using the [http://www.modpython.org/live/current/doc-html/pyapi-interps.html support for multiple python interpreters]! There appears to be a problem with loading the ClearSilver library (and/or python bindings) more than once per process. When you try to use multiple interpreters, every instance other than the first instance you accessed will fail with an import error on {{{neo_cs}}}.
Note:
See
WikiFormatting
and
TracWiki
for help on editing wiki content.
Change information
Your email or username:
E-mail address and name can be saved in the
Preferences
Comment about this change (optional):
Note:
See
TracWiki
for help on using the wiki.