There’s a great thread on the Ubuntu forums regarding this topic. For the purpose of keeping a record of what I needed to do:
- Install Apache 2
- Install libapache2-mod-wsgi
# apt-get install libapache2-mod-wsgi
- Link the project directory to /var/www
# cd /var/www
# ln -s /some/path/DevTools
- Update /etc/apache2/sites-available/default
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride None
Order allow,deny
allow from all
AddHandler cgi-script .cgi
AddHandler wsgi-script .wsgi
</Directory>
- Restart Apache
# apache2ctl restart
- Create the tester script, /var/www/DevTools/tester.wsgi
def application(environ, start_response):
status = "200 OK"
output = "Hello World!"
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
- Verify your tester by going to http://localhost/DevTools/tester.wsgi. The output should be:
Hello World!
If you get any 500 Server Error responses, check /var/log/apache2/error.log first. mod_python does a better job with error reporting than WSGI but is, in my experience, a more fragile framework for configuring and developing web apps.