Changes between Version 168 and Version 169 of TracModPython
- Timestamp:
- May 9, 2015, 1:22:03 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracModPython
v168 v169 13 13 14 14 If you just installed mod_python, you may have to add a line to load the module in the Apache configuration: 15 {{{ 15 {{{#!apache 16 16 LoadModule python_module modules/mod_python.so 17 17 }}} … … 20 20 21 21 On Debian using apt-get: 22 {{{ 22 {{{#!sh 23 23 apt-get install libapache2-mod-python libapache2-mod-python-doc 24 24 }}} 25 25 26 26 Still on Debian, after you have installed mod_python, you must enable the modules in apache2, equivalent to the above Load Module directive: 27 {{{ 27 {{{#!sh 28 28 a2enmod python 29 29 }}} 30 30 31 31 On Fedora use, using yum: 32 {{{ 32 {{{#!sh 33 33 yum install mod_python 34 34 }}} 35 35 36 36 You can test your mod_python installation by adding the following to your httpd.conf. You should remove this when you are done testing for security reasons. Note: mod_python.testhandler is only available in mod_python 3.2+. 37 {{{#! xml37 {{{#!apache 38 38 <Location /mpinfo> 39 39 SetHandler mod_python … … 46 46 47 47 A simple setup of Trac on mod_python looks like this: 48 {{{#! xml48 {{{#!apache 49 49 <Location /projects/myproject> 50 50 SetHandler mod_python … … 61 61 62 62 The options available are: 63 {{{ 63 {{{#!apache 64 64 # For a single project 65 65 PythonOption TracEnv /var/trac/myproject … … 84 84 85 85 Compressed Python eggs like Genshi are normally extracted into a directory named `.python-eggs` in the users home directory. Since Apache's home usually is not writeable, an alternate egg cache directory can be specified like this: 86 {{{ 86 {{{#!apache 87 87 PythonOption PYTHON_EGG_CACHE /var/trac/myprojects/egg-cache 88 88 }}} … … 100 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. 101 101 102 {{{#! xml102 {{{#!apache 103 103 <Location /projects/myproject> 104 104 ... … … 111 111 112 112 If the Trac installation isn't installed in your Python path, you will have to tell Apache where to find the Trac mod_python handler using the `PythonPath` directive: 113 {{{#! xml113 {{{#!apache 114 114 <Location /projects/myproject> 115 115 ... … … 124 124 125 125 The Trac mod_python handler supports a configuration option similar to Subversion's `SvnParentPath`, called `TracEnvParentDir`: 126 {{{#! xml126 {{{#!apache 127 127 <Location /projects> 128 128 SetHandler mod_python … … 137 137 138 138 If you don't want to have the subdirectory listing as your projects home page you can use a 139 {{{#! xml139 {{{#!apache 140 140 <LocationMatch "/.+/"> 141 141 }}} … … 144 144 145 145 You can also use the same authentication realm for all of the projects using a `<LocationMatch>` directive: 146 {{{#! xml146 {{{#!apache 147 147 <LocationMatch "/projects/[^/]+/login"> 148 148 AuthType Basic … … 158 158 `http://trac.mycompany.com`: 159 159 160 {{{#! xml161 <VirtualHost * 160 {{{#!apache 161 <VirtualHost *> 162 162 DocumentRoot /var/www/myproject 163 163 ServerName trac.mycompany.com … … 190 190 191 191 If you get server error pages, you can either check the Apache error log, or enable the `PythonDebug` option: 192 {{{#! xml192 {{{#!apache 193 193 <Location /projects/myproject> 194 194 ... … … 203 203 If you've used `<Location />` directive, it will override any other directives, as well as `<Location /login>`. 204 204 The workaround is to use negation expression as follows (for multi project setups): 205 {{{#! xml205 {{{#!apache 206 206 #this one for other pages 207 207 <Location ~ "/*(?!login)"> … … 210 210 PythonOption TracEnvParentDir /projects 211 211 PythonOption TracUriRoot / 212 213 </Location> 212 </Location> 213 214 214 #this one for login page 215 215 <Location ~ "/[^/]+/login"> … … 262 262 263 263 This also works out-of-box, with following trivial config: 264 {{{#! xml264 {{{#!apache 265 265 SetHandler mod_python 266 266 PythonInterpreter main_interpreter … … 281 281 If you are using the .htaccess method you may have additional problems if your Trac directory is inheriting .htaccess directives from another. This may also help to add to your .htaccess file: 282 282 283 {{{#! xml283 {{{#!apache 284 284 <IfModule mod_rewrite.c> 285 285 RewriteEngine Off … … 330 330 331 331 You also need a recent version of `mod_python` in order to avoid a runtime error ({{{argument number 2: a 'apr_pool_t *' is expected}}}) due to the default usage of multiple sub-interpreters. Version 3.2.8 ''should'' work, though it's probably better to use the workaround described in [trac:#3371 #3371], in order to force the use of the main interpreter: 332 {{{ 332 {{{#!apache 333 333 PythonInterpreter main_interpreter 334 334 }}} … … 339 339 340 340 If the formatting of the Trac pages look weird, chances are that the style sheets governing the page layout are not handled properly by the web server. Try adding the following lines to your Apache configuration: 341 {{{#! xml341 {{{#!apache 342 342 Alias /myproject/css "/usr/share/trac/htdocs/css" 343 343 <Location /myproject/css> … … 353 353 354 354 If you want to run Trac fully under https you might find that it tries to redirect to plain http. In this case just add the following line to your Apache configuration: 355 {{{#! xml356 <VirtualHost * 355 {{{#!apache 356 <VirtualHost *> 357 357 DocumentRoot /var/www/myproject 358 358 ServerName trac.mycompany.com