Skip to content

Instantly share code, notes, and snippets.

@creimers
Created April 2, 2015 00:27
Show Gist options
  • Save creimers/48d0ba093c1a7fbdebf0 to your computer and use it in GitHub Desktop.
Save creimers/48d0ba093c1a7fbdebf0 to your computer and use it in GitHub Desktop.
wsgi.py
import os
from django.core.handlers.wsgi import WSGIHandler
import django
class WSGIEnvironment(WSGIHandler):
def __call__(self, environ, start_response):
os.environ['DATABASE_URL'] = environ['DATABASE_URL']
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "my_app.settings")
django.setup()
return super(WSGIEnvironment, self).__call__(environ, start_response)
application = WSGIEnvironment()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment