Changes between Version 1 and Version 2 of TracModPython


Ignore:
Timestamp:
Jan 16, 2024, 12:52:37 AM (3 months ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TracModPython

    v1 v2  
    66Trac supports [http://www.modpython.org/ mod_python], which speeds up Trac's response times considerably, especially compared to [TracCgi CGI], and permits use of many Apache features not possible with [wiki:TracStandalone tracd]/mod_proxy.
    77
    8 These instructions are for Apache 2. If you are using Apache 1.3, you may have some luck with [trac:wiki:TracModPython2.7 TracModPython2.7], but that is a deprecated setup.
    9 
    108[[PageOutline(2-3,Overview,inline)]]
    119
    12 == Simple configuration: single project == #Simpleconfiguration
     10== Simple configuration: single project #Simpleconfiguration
    1311
    1412If you just installed mod_python, you may have to add a line to load the module in the Apache configuration:
     
    3735{{{#!apache
    3836<Location /mpinfo>
    39    SetHandler mod_python
    40    PythonInterpreter main_interpreter
    41    PythonHandler mod_python.testhandler
    42    Order allow,deny
    43    Allow from all
     37  SetHandler mod_python
     38  PythonInterpreter main_interpreter
     39  PythonHandler mod_python.testhandler
     40  # For Apache 2.2
     41  <IfModule !mod_authz_core.c>
     42    Order allow,deny
     43    Allow from all
     44  </IfModule>
     45  # For Apache 2.4
     46  <IfModule mod_authz_core.c>
     47    Require all granted
     48  </IfModule>
    4449</Location>
    4550}}}
     
    4853{{{#!apache
    4954<Location /projects/myproject>
    50    SetHandler mod_python
    51    PythonInterpreter main_interpreter
    52    PythonHandler trac.web.modpython_frontend
    53    PythonOption TracEnv /var/trac/myproject
    54    PythonOption TracUriRoot /projects/myproject
    55    Order allow,deny
    56    Allow from all
     55  SetHandler mod_python
     56  PythonInterpreter main_interpreter
     57  PythonHandler trac.web.modpython_frontend
     58  PythonOption TracEnv /var/trac/myproject
     59  PythonOption TracUriRoot /projects/myproject
     60  # For Apache 2.2
     61  <IfModule !mod_authz_core.c>
     62    Order allow,deny
     63    Allow from all
     64  </IfModule>
     65  # For Apache 2.4
     66  <IfModule mod_authz_core.c>
     67    Require all granted
     68  </IfModule>
    5769</Location>
    5870}}}
     
    7183PythonOption TracEnvIndexTemplate /srv/www/htdocs/trac/project_list_template.html
    7284
    73 # A space delimitted list, with a "," between key and value pairs.
     85# A space delimited list, with a "," between key and value pairs.
    7486PythonOption TracTemplateVars key1,val1 key2,val2
    7587
     
    7789PythonOption TracLocale en_GB.UTF8
    7890
    79 # See description above       
     91# See description above
    8092PythonOption TracUriRoot /projects/myproject
    8193}}}
     
    98110=== Setting the Python Egg Cache
    99111
    100 If the Egg Cache isn't writeable by your Web server, you'll either have to change the permissions, or point Python to a location where Apache can write. This can manifest itself as a `500 internal server error` and/or a complaint in the syslog. 
     112If the Egg Cache isn't writeable by your Web server, you'll either have to change the permissions, or point Python to a location where Apache can write. This can manifest itself as a `500 internal server error` and/or a complaint in the syslog.
    101113
    102114{{{#!apache
    103115<Location /projects/myproject>
    104116  ...
    105   PythonOption PYTHON_EGG_CACHE /tmp 
     117  PythonOption PYTHON_EGG_CACHE /tmp
    106118  ...
    107119</Location>
     
    128140  SetHandler mod_python
    129141  PythonInterpreter main_interpreter
    130   PythonHandler trac.web.modpython_frontend 
     142  PythonHandler trac.web.modpython_frontend
    131143  PythonOption TracEnvParentDir /var/trac
    132144  PythonOption TracUriRoot /projects
     
    135147
    136148When you request the `/projects` URL, you will get a listing of all subdirectories of the directory you set as `TracEnvParentDir` that look like Trac environment directories. Selecting any project in the list will bring you to the corresponding Trac environment.
     149
     150Directories residing in `TracEnvParentDir` that are not environment directories will display an error message on the [TracInterfaceCustomization#ProjectList project index page]. The directories can be excluded by listing them in a `.tracignore` file residing in `TracEnvParentDir`. Unix [https://docs.python.org/2/library/fnmatch.html shell-style wildcard patterns] can be used in the newline separated list of directories.
    137151
    138152If you don't want to have the subdirectory listing as your projects home page you can use a
     
    220234
    221235   #remove these if you don't want to force SSL
    222    RewriteEngine On 
     236   RewriteEngine On
    223237   RewriteCond %{HTTPS} off
    224238   RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
     
    231245}}}
    232246
    233 === Expat-related segmentation faults === #expat
    234 
    235 This problem will most certainly hit you on Unix when using Python 2.4.
    236 In Python 2.4, some version of [http://expat.sourceforge.net/ Expat] (an XML parser library written in C) is used and if Apache is using another version, this results in segmentation faults.
    237 As Trac 0.11 is using Genshi, which will indirectly use Expat, that problem can now hit you even if everything was working fine before with Trac 0.10. This problem has not been reported for Python 2.5+, so best to upgrade.
    238 
    239247=== Form submission problems
    240248
     
    265273SetHandler mod_python
    266274PythonInterpreter main_interpreter
    267 PythonHandler trac.web.modpython_frontend 
     275PythonHandler trac.web.modpython_frontend
    268276PythonOption TracEnv /system/path/to/this/directory
    269277PythonOption TracUriRoot /path/on/apache
     
    304312}}}
    305313
    306 See also [http://subversion.apache.org/faq.html#reposperms How do I set repository permissions correctly?]
     314See also [https://subversion.apache.org/faq.html#reposperms How do I set repository permissions correctly?]
    307315
    308316==== FreeBSD issues
     
    347355
    348356'''Note''': For the above configuration to have any effect it must be put after the configuration of your project root location, ie {{{<Location /myproject />}}}.
    349 
    350 Also, setting `PythonOptimize On` seems to mess up the page headers and footers, in addition to hiding the documentation for macros and plugins (see #Trac8956). Considering how little effect the option has, leave it `Off`.
    351357
    352358=== HTTPS issues
     
    364370=== Segmentation fault with php5-mhash or other php5 modules
    365371
    366 You may encounter segfaults (reported on Debian etch) if php5-mhash module is installed. Try to remove it to see if this solves the problem. See [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=411487 Debian bug report].
    367 
    368 Some people also have troubles when using PHP5 compiled with its own third party libraries instead of system libraries. Check [http://www.djangoproject.com/documentation/modpython/#if-you-get-a-segmentation-fault Django segmentation fault].
     372You may encounter segfaults (reported on Debian etch) if php5-mhash module is installed. Try to remove it to see if this solves the problem. See [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=411487 Debian bug report].
     373
     374Some people also have troubles when using PHP5 compiled with its own third party libraries instead of system libraries. Check [https://www.djangoproject.com/documentation/modpython/#if-you-get-a-segmentation-fault Django segmentation fault].
    369375
    370376----