Skip to content

Instantly share code, notes, and snippets.

@mcnemesis
Created May 24, 2013 19:52
Show Gist options
  • Save mcnemesis/5646069 to your computer and use it in GitHub Desktop.
Save mcnemesis/5646069 to your computer and use it in GitHub Desktop.
My Django WSGI bootstrap script that is *so generic* it might work as a default replacement in any standard Django project. If you created your project using the default: django-admin.py startproject PROJECT, then just try switching your PROJECT/PROJECT/wsgi.py with this.
import os, sys
base = os.path.dirname(os.path.dirname(__file__))
base_parent = os.path.dirname(base)
sys.path.append(base)
sys.path.append(base_parent)
os.environ['DJANGO_SETTINGS_MODULE'] = '%s.settings' % os.path.basename( os.path.dirname(__file__) )
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment