Changes between Version 2 and Version 3 of TracModWSGI


Ignore:
Timestamp:
Dec 3, 2015, 10:33:43 AM (8 years ago)
Author:
trac
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • TracModWSGI

    v2 v3  
    22
    33
    4 [http://code.google.com/p/modwsgi/ mod_wsgi] is an Apache module for running WSGI-compatible Python applications directly on top of the Apache webserver. The mod_wsgi adapter is written completely in C and provides very good performances.
     4[http://code.google.com/p/modwsgi/ mod_wsgi] is an Apache module for running WSGI-compatible Python applications directly on top of the Apache webserver. The mod_wsgi adapter is written completely in C and provides very good performance.
    55
    66[[PageOutline(2-3,Overview,inline)]]
     
    2424
    2525The `TRAC_ENV` variable should naturally be the directory for your Trac environment (if you have several Trac environments in a directory, you can also use `TRAC_ENV_PARENT_DIR` instead), while the `PYTHON_EGG_CACHE` should be a directory where Python can temporarily extract Python eggs.
     26
     27On Windows:
     28 - If run under the user's session, the Python Egg cache can be found in `%AppData%\Roaming`, for example:
     29{{{#!python
     30os.environ['PYTHON_EGG_CACHE'] = r'C:\Users\Administrator\AppData\Roaming\Python-Eggs'
     31}}}
     32 - If run under a Window service, you should create a directory for Python Egg cache.
     33{{{#!python
     34os.environ['PYTHON_EGG_CACHE'] = r'C:\Trac-Python-Eggs'
     35}}}
    2636
    2737=== A more elaborate script
     
    7383Here, the script is in a subdirectory of the Trac environment.
    7484
    75 If you followed the directions [http://trac.edgewall.org/wiki/TracInstall#cgi-bin Generating the Trac cgi-bin directory], your Apache configuration file should look like following:
     85If you followed the directions [TracInstall#cgi-bin Generating the Trac cgi-bin directory], your Apache configuration file should look like following:
    7686
    7787{{{
     
    171181
    172182For multiple environments, you can use the same `LocationMatch` as described with the previous method.
     183
     184'''Note: `Location` cannot be used inside .htaccess files, but must instead live within the main httpd.conf file. If you are on a shared server, you therefore will not be able to provide this level of granularity. '''
    173185
    174186Don't forget to activate the mod_auth_digest. For example, on a Debian 4.0r1 (etch) system:
     
    308320</Location>
    309321}}}
    310 Note that '''authFile''' need not exist. See the !HttpAuthStore link above for examples where multiple Trac projects are hosted on a server.
     322Note that '''authFile''' need not exist (unless you are using Account Manager older than 0.4). See the !HttpAuthStore link above for examples where multiple Trac projects are hosted on a server.
    311323
    312324=== Example: Apache/mod_wsgi with Basic Authentication, Trac being at the root of a virtual host
     
    360372''Note: using mod_wsgi 2.5 and Python 2.6.1 gave an Internal Server Error on my system (Apache 2.2.11 and Trac 0.11.2.1). Upgrading to Python 2.6.2 (as suggested [http://www.mail-archive.com/modwsgi@googlegroups.com/msg01917.html here]) solved this for me[[BR]]-- Graham Shanks''
    361373
     374If you plan to use `mod_wsgi` in embedded mode on Windows or with the MPM worker on Linux, then you'll even need version 0.3.4 or greater (see [trac:#10675] for details).
     375
    362376=== Getting Trac to work nicely with SSPI and 'Require Group' ===
    363377If like me you've set Trac up on Apache, Win32 and configured SSPI, but added a 'Require group' option to your apache configuration, then the SSPIOmitDomain option is probably not working.  If its not working your usernames in trac are probably looking like 'DOMAIN\user' rather than 'user'.
     
    386400But it's not necessary to edit the source of Trac, the following lines in `trac.wsgi` will also work:
    387401
    388 {{{
     402{{{#!python
    389403import trac.db.postgres_backend
    390404trac.db.postgres_backend.PostgreSQLConnection.poolable = False
    391405}}}
    392406
     407or
     408
     409{{{#!python
     410import trac.db.mysql_backend
     411trac.db.mysql_backend.MySQLConnection.poolable = False
     412}}}
     413
    393414Now Trac drops the connection after serving a page and the connection count on the database will be kept minimal.
    394415
     
    397418=== Other resources
    398419
    399 For more troubleshooting tips, see also the [TracModPython#Troubleshooting mod_python troubleshooting] section, as most Apache-related issues are quite similar, plus discussion of potential [http://code.google.com/p/modwsgi/wiki/ApplicationIssues application issues] when using mod_wsgi.
     420For more troubleshooting tips, see also the [TracModPython#Troubleshooting mod_python troubleshooting] section, as most Apache-related issues are quite similar, plus discussion of potential [http://code.google.com/p/modwsgi/wiki/ApplicationIssues application issues] when using mod_wsgi. The wsgi page also has a [http://code.google.com/p/modwsgi/wiki/IntegrationWithTrac Integration With Trac] document.
    400421
    401422