Created
March 13, 2009 03:22
-
-
Save lincolnloop/78416 to your computer and use it in GitHub Desktop.
Django mod_wsgi scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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