Edgewall Software

Changes between Initial Version and Version 1 of TracModWSGI


Ignore:
Timestamp:
Mar 16, 2007, 3:21:54 PM (17 years ago)
Author:
Manuzhai
Comment:

Add instructions for the upcoming mod_wsgi.

Legend:

Unmodified
Added
Removed
Modified
  • TracModWSGI

    v1 v1  
     1= Trac and mod_wsgi =
     2
     3[http://code.google.com/p/modwsgi/ mod_wsgi] is an experimental Apache module for running WSGI-compatible Python applications directly on top of Apache:
     4
     5  The mod_wsgi adapter is an Apache module that provides a WSGI compliant interface for hosting Python based web applications within Apache. The adapter is written completely in C code against the Apache C runtime and for hosting WSGI applications within Apache provides significantly better performance than using existing WSGI adapters for mod_python or CGI.
     6
     7It is already possible to run Trac on top of mod_wsgi. This can be done by writing the following application script.
     8
     9{{{
     10import os
     11
     12os.environ['TRAC_ENV'] = '/usr/local/trac/mysite'
     13os.environ['PYTHON_EGG_CACHE'] = '/usr/local/trac/mysite/eggs'
     14
     15import trac.web.main
     16application = trac.web.main.dispatch_request
     17}}}
     18
     19The {{{TRAC_ENV}}} variable should naturally be the directory for your Trac environment (if you have several Trac environments in a directory, you can also you {{{TRAC_ENV_PARENT_DIR}}} instead), while the {{{PYTHON_EGG_CACHE}}} should be a directory where Python can temporarily extract Python eggs. For clarity, you should give this file a {{{.wsgi}}} extension. You should probably put the file in it's own directory, since you will open up it's directory to Apache.
     20
     21After you've done this, add the following to your httpd.conf.
     22
     23{{{
     24WSGIScriptAlias /trac /usr/local/trac/mysite/apache/mysite.wsgi
     25
     26<Directory /usr/local/trac/mysite/apache>
     27    Order deny,allow
     28    Allow from all
     29</Directory>
     30}}}
     31
     32Here, the script is in a subdirectory of the Trac environment. In order to let Apache run the script, access to the directory in which the script resides is opened up to all of Apache. Restart Apache, and then it should work.
     33
     34See also the mod_wsgi [http://code.google.com/p/modwsgi/wiki/IntegrationWithTrac installation instructions] for Trac.