Home

Documentation

Project Support

Changes in Version 1 of TracModPython

Author:
trac
Timestamp:
Wed Aug 23 17:34:43 2006

Legend:

Unmodified
Added
Removed
Modified
  • TracModPython

    v0 v1
      1  = Trac and mod_python = 
      2   
      3  Trac 0.7.1 and later 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. 
      4   
      5  == Simple configuration == 
      6   
      7  Here's a typical Trac CGI/Apache setup: 
      8   
      9  {{{ 
      10  ScriptAlias /projects/myproject /path/to/python/share/trac/cgi-bin/trac.cgi 
      11  <Location /projects/myproject> 
      12     SetEnv TRAC_ENV /var/trac/myproject 
      13  </Location> 
      14  }}} 
      15   
      16  The equivalent mod_python setup is: 
      17   
      18  {{{ 
      19  <Location /projects/myproject> 
      20     SetHandler mod_python 
      21     PythonHandler trac.ModPythonHandler 
      22     PythonOption TracUriRoot "/projects/myproject" 
      23     PythonOption TracEnv /var/trac/myproject 
      24  </Location> 
      25  }}} 
      26   
      27  Note that the option ''TracUriRoot'' may or may not be necessary in your setup. Try without first, and if the URLs produced by Trac look wrong, add the ''TracUriRoot'' option. 
      28   
      29  == Setting up multiple projects == 
      30   
      31  The Trac mod_python handler handler supports a configuration option similar to Subversion's {{{SvnParentPath}}}, called {{{TracEnvParentDir}}}: 
      32   
      33  {{{ 
      34  <Location /projects> 
      35    SetHandler mod_python 
      36    PythonHandler trac.ModPythonHandler 
      37    PythonOption TracUriRoot /projects 
      38    PythonOption TracEnvParentDir "/var/trac" 
      39  </LocationMatch> 
      40  }}} 
      41   
      42  When you request the {{{/projects}}} 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. 
      43   
      44   
      45  === Adding authentication === 
      46   
      47  Adding authentication is straightforward in both cases. For example: 
      48   
      49  {{{ 
      50  <LocationMatch /projects/[[:alnum:]]+/login> 
      51    AuthType Basic 
      52    AuthName "Trac" 
      53    AuthUserFile /var/www/passwd 
      54    Require valid-user 
      55  </LocationMatch> 
      56  }}} 
      57   
      58  === Win32 Issues === 
      59   
      60  If you run trac with mod_python on Windows, attachments will not work. 
      61   
      62  There is a (simple) workaround for this which is to apply the patch attached to  
      63  ticket [http://projects.edgewall.com/trac/ticket/554 #554]. 
      64   
      65   
      66  ---- 
      67  See also TracGuide, TracInstall, TracMultipleProjects