Configuring wsgi for a simple Python based site

Posted by jbbarnes on Server Fault See other posts from Server Fault or by jbbarnes
Published on 2012-10-24T21:35:13Z Indexed on 2012/10/24 23:03 UTC
Read the original article Hit count: 250

Filed under:
|
|

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.

© Server Fault or respective owner

Related posts about apache2

Related posts about python