Commit 2ad2af87 authored by Martin Krafft's avatar Martin Krafft Committed by Jeremy Kerr
Browse files

lib/apache2: Add WSGI Handler

Patchwork/Django can be run directly with WSGI, which is bound to be
faster and less complex than FastCGI. This patch provides the necessary
Apache configuration and the WSGI handler, as well as an update to the

Since python-flup is deprecated and WSGI supersedes FastCGI, it should
be(come) the preferred method. Hence I documented it first.

For the xmlrpc interface to work with WSGI, the HTTP authorization
information needs to be passed to the WSGI handler. This is done by
setting WSGIPassAuthorization On in the apache2 config file snippet.


Signed-off-by: default avatarmartin f. krafft <>
Signed-off-by: default avatarJeremy Kerr <>
parent ef3b7b60
......@@ -153,10 +153,22 @@ in brackets):
Example apache configuration files are in lib/apache/.
django has built-in support for WSGI, which supersedes the fastcgi
handler. It is thus the preferred method to run patchwork.
The necessary configuration for Apache2 may be found in
You will need to install/enable mod_wsgi for this to work:
a2enmod wsgi
apache2ctl restart
This should be the simpler of the two to set up. An example apache
configuration file is in:
An example apache configuration file for mod_python is in:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Apache2 WSGI handler for patchwork
# Copyright © 2010 martin f. krafft <>
# Released under the GNU General Public License v2 or later.
import os
import sys
basedir = os.path.dirname(__file__)
os.environ['DJANGO_SETTINGS_MODULE'] = 'apps.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
<IfModule mod_alias.c>
Alias /images/ "/srv/patchwork/htdocs/images/"
Alias /css/ "/srv/patchwork/htdocs/css/"
Alias /js/ "/srv/patchwork/htdocs/js/"
Alias /robots.txt "/srv/patchwork/htdocs/robots.txt"
<Directory "/srv/patchwork/htdocs">
Order allow,deny
Allow from all
Alias /media/ "/usr/share/python-support/python-django/django/contrib/admin/media/"
<Directory "/usr/share/python-support/python-django/django/contrib/admin/media/">
Order allow,deny
Allow from all
WSGIScriptAlias / "/srv/patchwork/patchwork.wsgi"
WSGIPassAuthorization On
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment