Most guides I saw for creating the WSGI apply for use with mod_wsgi either sets up for Django or Pylons. However, I must produce the wsgi file without configuring it for just about any particular framework. How do you do that. This is a code in the wsgi script to be used 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 stated that I have to add the next code towards the WSGI script to overlay the BASELINE atmosphere (yep, I'm utilizing a baseline and application-specific virtualenv):
import site site.addsitedir('/usr/local/pythonenv/PYLONS-1/lib/python2.5/site-packages')
The way my WSGI script seem like should i be not utilizing it for just about any particular framework?
EDIT: To use with Apache server
For that simple wsgi application in PEP 333:
def simple_app(environ, start_response): status = '200 OK' response_headers = [('Content-type', 'text/plain')] start_response(status, response_headers) return ['Hello world!\n'] application = simple_app
Quite simply, you do not have to complete any setup whatsoever. You just need to make certain that mod_wsgi will find an
application object that adjusts to wsgi inside your module.
For security reasons, you actually must define the application in another module outdoors any sites released by apache, and limit the code inside your wsgi file towards the minimum needed to import that module and bind the wsgi application within towards the