Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Django mod_wsgi scripts

View django.wsgi
1 2 3 4 5 6 7 8 9 10 11 12 13 14
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()
View django.wsgi
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
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.