From 2ad2af87e5e438f26ae1f26d21d02052f75cc091 Mon Sep 17 00:00:00 2001 From: Martin Krafft Date: Sun, 31 Jan 2010 02:32:45 +0100 Subject: 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 docs. 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. Ref: http://www.arnebrodowski.de/blog/508-Django,-mod_wsgi-and-HTTP-Authentication.html Signed-off-by: martin f. krafft Signed-off-by: Jeremy Kerr --- lib/apache2/patchwork.wsgi | 17 +++++++++++++++++ lib/apache2/patchwork.wsgi.conf | 20 ++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 lib/apache2/patchwork.wsgi create mode 100644 lib/apache2/patchwork.wsgi.conf (limited to 'lib') diff --git a/lib/apache2/patchwork.wsgi b/lib/apache2/patchwork.wsgi new file mode 100644 index 0000000..0488b48 --- /dev/null +++ b/lib/apache2/patchwork.wsgi @@ -0,0 +1,17 @@ +#!/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__) +sys.path.append(basedir) + +os.environ['DJANGO_SETTINGS_MODULE'] = 'apps.settings' +import django.core.handlers.wsgi +application = django.core.handlers.wsgi.WSGIHandler() diff --git a/lib/apache2/patchwork.wsgi.conf b/lib/apache2/patchwork.wsgi.conf new file mode 100644 index 0000000..e99f8c6 --- /dev/null +++ b/lib/apache2/patchwork.wsgi.conf @@ -0,0 +1,20 @@ + + 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" + + Order allow,deny + Allow from all + + + Alias /media/ "/usr/share/python-support/python-django/django/contrib/admin/media/" + + + Order allow,deny + Allow from all + + + +WSGIScriptAlias / "/srv/patchwork/patchwork.wsgi" +WSGIPassAuthorization On -- cgit v1.2.3