DevReview.net

More development notices …

Config apache mod_wsgi for python web applications

leave a comment

Installing mod_wsgi
Example of http.conf:
LoadModule wsgi_module        libexec/apache22/mod_wsgi.so

Example


ServerName python.dev
ServerAdmin webmaster@python.dev
DocumentRoot "/usr/local/www/apache22/data/sites/python.dev"


Order allow,deny
Allow from all

WSGIScriptAlias / /usr/local/www/apache22/data/sites/python.dev/index.py

ErrorLog "/var/log/python.dev-error_log"
CustomLog "/var/log/python.dev-access_log" common

Example of index.py

def application(environ, start_response):
status = '200 OK'
output = 'Hee ello 34 World!'

response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)

return [output]

restart apache & check http://python.dev

Written by admin

May 29th, 2011 at 1:29 pm

Posted in python

Tagged with , , ,