Edgewall Software

Changes between Version 16 and Version 17 of ModPython


Ignore:
Timestamp:
Nov 12, 2004, 8:20:47 PM (19 years ago)
Author:
Jonas Borgström
Comment:

cleanup

Legend:

Unmodified
Added
Removed
Modified
  • ModPython

    v16 v17  
    22
    33Trac 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 '''Note''': The mod_python support in 0.7.1 has a couple of bugs that have since been fixed in both the [http://projects.edgewall.com/trac/browser/branches/0.7-stable 0.7 branch] and [http://projects.edgewall.com/trac/browser/trunk trunk], and will be released with [http://projects.edgewall.com/trac/milestone/0.8 0.8].
    64
    75== Simple configuration ==
     
    108
    119{{{
    12 ScriptAlias /trac/myproject /path/to/python/share/trac/cgi-bin/trac.cgi
    13 <Location /trac/myproject>
    14    SetEnv TRAC_ENV /var/svn/trac/myproject
     10ScriptAlias /projects/myproject /path/to/python/share/trac/cgi-bin/trac.cgi
     11<Location /projects/myproject>
     12   SetEnv TRAC_ENV /var/trac/myproject
    1513</Location>
    1614}}}
     
    1917
    2018{{{
    21 <Location /trac/myproject>
     19<Location /projects/myproject>
    2220   SetHandler mod_python
    2321   PythonHandler trac.ModPythonHandler
    24    PythonOption TracUriRoot "/trac/myproject"
    25    PythonOption TracEnv /var/svn/trac/myproject
     22   PythonOption TracUriRoot "/projects/myproject"
     23   PythonOption TracEnv /var/trac/myproject
    2624</Location>
    2725}}}
     
    3129== Setting up multiple projects ==
    3230
    33 === The easy way ===
    34 
    3531The Trac mod_python handler handler supports a configuration option similar to Subversion's {{{SvnParentPath}}}, called {{{TracEnvParentDir}}}:
    3632
    3733{{{
    38 <LocationMatch /trac>
     34<LocationMatch /projects>
    3935  SetHandler mod_python
    4036  PythonHandler trac.ModPythonHandler
    41   PythonOption TracUriRoot /trac
    42   PythonOption TracEnvParentDir "/var/www/projects"
     37  PythonOption TracUriRoot /projects
     38  PythonOption TracEnvParentDir "/var/trac"
    4339</LocationMatch>
    4440}}}
    4541
    46 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.
     42When 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.
    4743
    48 === Or the hard way ===
    49 
    50 The Trac mod_python handler can be configured to serve multiple projects, as can be seen in the following simple example:
    51 
    52 {{{
    53 <LocationMatch /trac/[[:alnum:]]+>
    54   SetHandler mod_python
    55   PythonHandler trac.ModPythonHandler
    56 </LocationMatch>
    57 <Location /trac/exampleone>
    58   PythonOption TracUriRoot "/trac/exampleone"
    59   PythonOption TracEnv "/var/www/projects/exampleone"
    60 </Location>
    61 <Location /trac/exampletwo>
    62   PythonOption TracUriRoot "/trac/exampletwo"
    63   PythonOption TracEnv "/var/www/projects/exampletwo"
    64 </Location>
    65 }}}
    66 
    67 This sets up two projects. The disadvantage of the approach used here is that you need one additional {{{<Location>}}} directive per Trac instance. You may be able to eliminate this using some mod_rewrite tricks.
    6844
    6945=== Adding authentication ===
     
    7248
    7349{{{
    74 <LocationMatch /trac/[[:alnum:]]+/login>
     50<LocationMatch /projects/[[:alnum:]]+/login>
    7551  AuthType Basic
    7652  AuthName "Trac"