= Trac and mod_python = Trac 0.7.1 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 SetEnv TRAC_ENV /var/svn/trac/myproject }}} The equivalent mod_python setup is: {{{ SetHandler mod_python PythonHandler trac.ModPythonHandler PythonOption TracEnv /var/svn/trac/myproject }}} ''Note: you might 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 == === The hard way === The Trac mod_python handler can be configured to serve multiple projects, as can be seen in the following simple example: {{{ SetHandler mod_python PythonHandler trac.ModPythonHandler PythonOption TracEnv "/var/www/projects/exampleone" PythonOption TracEnv "/var/www/projects/exampletwo" }}} This sets up two projects. The disadvantage of the approach used here is that you need one additional {{{}}} directive per Trac instance. Although you may be able to eliminate this using some mod_rewrite tricks, you can also make use of the built-in support for multiple projects, as described in the next section. === Or the easy way === The Trac mod_python handler handler supports a configuration option similar to Subversion's {{{SvnParentPath}}}, called {{{TracEnvParentDir}}}: {{{ SetHandler mod_python PythonHandler trac.ModPythonHandler PythonOption TracEnvParentDir "/var/www/projects" }}} When you request the {{{/trac}}} URL, you will get a (currently very simple) listing of all subdirectories of the directory you set as {{{TracEnvParentDir}}}. Selecting any project in the list will bring you to the corresponding Trac instance. You should make sure that the configured directory only contains Trac environment directories that match the currently installed Trac version, because that is not checked prior the the generation of the project list. === Adding authentication === Adding authentication is straightforward in both cases. For example: {{{ AuthType Basic AuthName "Trac" AuthUserFile /var/www/passwd Require valid-user }}} == 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}}}. ---- See also TracGuide, TracInstall, TracMultipleProjects