Most guides I saw for creating the WSGI file for use with mod_wsgi either sets it up for Django or Pylons. However, I would like to create the wsgi file without setting it up for any particular framework. How do I do this. The following is a code from the wsgi script for use with Django:
import os, sys
sys.path.append('/home/user/dev')
sys.path.append('/home/user/dev/site1')
os.environ['DJANGO_SETTINGS_MODULE'] = 'site1.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
The mod_wsgi integration from google said that I need to add the following code to the WSGI script to overlay the BASELINE environment (yep, I am using a baseline and application-specific virtualenv):
import site
site.addsitedir('/usr/local/pythonenv/PYLONS-1/lib/python2.5/site-packages')
How will my WSGI script look like if I am not using it for any particular framework?
EDIT: This is for use with Apache server
For the simple wsgi application in PEP 333:
In other words, you don’t have to do any setup at all. You just have to make sure that mod_wsgi can find an
applicationobject that conforms to wsgi in your module.For security reasons, you really ought to define your application in another module outside any directories published by apache, and limit the code in your wsgi file to the minimum required to import that module and bind the wsgi application within to the
applicationvariable.