Skip to content
Search

Modwsgi:Trac

lastmod 2025-02-15created 2014-04-299 edits

Notes on how to use TRAC with WSGI.

Apache HTTPD Configure

httpd.conf File:

LoadModule wsgi_module libexec/apache2/mod_wsgi.so
# ...
<IfModule wsgi_module>
Include /private/etc/apache2/extra/httpd-wsgi.conf
</IfModule>

httpd-wsgi.conf File:

WSGIScriptAlias /trac "/private/etc/apache2/other/trac.wsgi"

<Location /trac>
    WSGIApplicationGroup %{GLOBAL}
    Order deny,allow
    Allow from all

    # Auth setting.
    AuthType Basic
    AuthName "Trac"
    AuthUserFile "/private/etc/apache2/htpasswd/htpasswd.ht"
    Require valid-user
</Location>

Importantly, it is best to hook up the authentication file for login during the first installation. This makes installing additional plugins easier afterward.

trac.wsgi File:

import os

os.environ['TRAC_ENV_PARENT_DIR'] = '/usr/local/repository/trac.repo'
#os.environ['TRAC_ENV'] = '/usr/local/repository/trac.repo/server'
os.environ['PYTHON_EGG_CACHE'] = '/usr/local/repository/trac.egg'

import trac.web.main
application = trac.web.main.dispatch_request

See also

Favorite site

author Zer0 sitemap