Skip to content

Instantly share code, notes, and snippets.

@hersonls
Created January 16, 2013 18:23
Show Gist options
  • Save hersonls/4549435 to your computer and use it in GitHub Desktop.
Save hersonls/4549435 to your computer and use it in GitHub Desktop.
import os
import sys
INTERP = os.path.join(os.environ['HOME'], '.virtualenvs', 'project', 'bin', 'python')
if sys.executable != INTERP:
os.execl(INTERP, INTERP, *sys.argv)
sys.path.insert(1, os.getcwd()) # '[...]./'
sys.path.insert(1, os.path.join(os.getcwd(), 'project')) # '[...]/project/'
import django.core.handlers.wsgi
os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings'
application = django.core.handlers.wsgi.WSGIHandler()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment