Skip to content

@lincolnloop /django.wsgi
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Django mod_wsgi scripts
import os, sys
import site
# put virtualenv on pythonpath
site.addsitedir('/path/to/project/ve/lib/python2.5/site-packages')
# redirect prints to apache log
sys.stdout = sys.stderr
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
import os, sys
import site
# put virtualenv on pythonpath
site.addsitedir('/path/to/project/ve/lib/python2.5/site-packages')
# redirect prints to apache log
sys.stdout = sys.stderr
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
import django.core.handlers.wsgi
_application = django.core.handlers.wsgi.WSGIHandler()
def application(environ, start_response):
# trick Satchmo into thinking proxied traffic is coming in via HTTPS
# HTTP_X_FORWARDED_SSL is used on WebFaction
if environ.get("HTTP_X_FORWARDED_PROTOCOL") == "https" or \
environ.get("HTTP_X_FORWARDED_SSL") == "on":
environ["wsgi.url_scheme"] = "https"
return _application(environ, start_response)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.