Configuring wsgi for a simple Python based site
- by jbbarnes
I have an Ubuntu 10.04 server that already has apache and wsgi working. I also have a python script that works just fine using the make_server command:
if __name__ == '__main__':
from wsgiref.simple_server import make_server
srv = make_server('', 8080, display_status)
srv.serve_forever()
Now I would like to have the page always active without having to run the script manually. I looked at what Moin is doing. I found these lines in apache2.conf:
WSGIScriptAlias /wiki /usr/local/share/moin/moin.wsgi
WSGIDaemonProcess moin user=www-data group=www-data processes=5 threads=10 maximum-requests=1000 umask=0007
WSGIProcessGroup moin
And moin.wsgi is as listed:
import sys, os
sys.path.insert(0, '/usr/local/share/moin')
from MoinMoin.web.serving import make_application
application = make_application(shared=True)
QUESTION:
Can I create a similar section in apache2.conf pointing to another wsgi file? Like this:
WSGIScriptAlias /status /mypath/status.wsgi
WSGIDaemonProcess status user=www-data group=www-data processes=5 threads=10 maximum-requests=1000 umask=0007
WSGIProcessGroup status
And if so, what is required to convert my simple_server script into a daemonized process? Most of the information I find about wsgi is related to using it with frameworks like Django. I haven't found a simple howto detailing how to make this work.
Thanks.