Prepare WSGI Script
First you will need to make a file that is readable by your webserver with the following content:
WSGI Script
import os import sys sys.path.insert(0,'/one/level/above') #insert to make sure that forum will be found sys.path.append('/one/level/above/OSQA') #maybe this is not necessary os.environ['DJANGO_SETTINGS_MODULE'|'DJANGO_SETTINGS_MODULE'] = 'OSQA.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()
The insert method is used for the path because if the forum directory name is the same as some other Python module you will see strange errors. For example, using the name "test" is not a good idea since there is already a module with such name.
Configure Webserver
Your webserver's settings file should be something like the text below. This may not be perfect, but it is a good starting point
Apache Config
WSGISocketPrefix /path/to/socket/sock #must be readable and writable by apache WSGIPythonHome /usr/local #must be readable by apache WSGIPythonEggs /var/python/eggs #must be readable and writable by apache #NOTE: all urs below will need to be adjusted if #settings.FORUM_SCRIPT_ALIAS !='' (e.g. = 'forum/') #this allows "rooting" forum at [http://example.com/forum], if you like <VirtualHost ...your ip...:80> ServerAdmin forum@example.com DocumentRoot /path/to/osqa-site ServerName example.com #run mod_wsgi process for django in daemon mode #this allows avoiding confused timezone settings when #another application runs in the same virtual host WSGIDaemonProcess OSQA WSGIProcessGroup OSQA #force all content to be served as static files #otherwise django will be crunching images through itself wasting time Alias /m/ /path/to/osqa-site/forum/skins/ Alias /upfiles/ /path/to/osqa-site/forum/upfiles/ <Directory /path/to/osqa-site/forum/skins> Order allow,deny Allow from all </Directory> #this is your wsgi script described in the prev section WSGIScriptAlias / /path/to/osqa-site/osqa.wsgi #this will force admin interface to work only #through https (optional) #"nimda" is the secret spelling of "admin" ;-) <Location "/nimda"> RewriteEngine on RewriteRule /nimda(.*)$ [https://example.com/nimda$1] [L,R=301] </Location> CustomLog /var/log/httpd/OSQA/access_log common ErrorLog /var/log/httpd/OSQA/error_log </VirtualHost> #(optional) run admin interface under https <VirtualHost ..your ip..:443> ServerAdmin forum@example.com DocumentRoot /path/to/osqa-site ServerName example.com SSLEngine on SSLCertificateFile /path/to/ssl-certificate/server.crt SSLCertificateKeyFile /path/to/ssl-certificate/server.key WSGIScriptAlias / /path/to/osqa-site/osqa.wsgi CustomLog /var/log/httpd/OSQA/access_log common ErrorLog /var/log/httpd/OSQA/error_log DirectoryIndex index.html </VirtualHost>

Comments (4)
May 23, 2010
Martin Cleaver says:
Perhaps you can explain how to find the values to set these three to? Thanks W...Perhaps you can explain how to find the values to set these three to? Thanks
Also, you've only got this line in the https section:
Is this correct?
Jul 25, 2010
sam says:
I would like to install this and have no idea where to start. Do i just upload t...I would like to install this and have no idea where to start.
Do i just upload these files to my domain? how do i prepare the script/configure the web server?
please help
web development newbie
Aug 01, 2010
michael z says:
Hi: Does '/one/level/above' refers to one level about where the WSGI script shou...Hi:
Does '/one/level/above' refers to one level about where the WSGI script should be put?
And also Where should I put the WSGI Script?
Jan 23, 2011
Shrike says:
What are these: WSGISocketPrefix /path/to/socket/sock #must be readable and wri...What are these:
?
It's absolutly unclear what is "/path/to/socket/sock" and "/var/python/eggs".
Could someone clarify a bit? THanks.