Skip to content

Instantly share code, notes, and snippets.

@Joevdwalt
Created October 31, 2016 09:46
Show Gist options
  • Save Joevdwalt/f7c2774efe7470eba61129f954b07ca7 to your computer and use it in GitHub Desktop.
Save Joevdwalt/f7c2774efe7470eba61129f954b07ca7 to your computer and use it in GitHub Desktop.
import os
import sys
import site
# Add the site-packages of the chosen virtualenv to work with
site.addsitedir('~/.virtualenvs/myprojectenv/local/lib/python2.7/site-packages')
# Add the app's directory to the PYTHONPATH
sys.path.append('/home/django_projects/MyProject')
sys.path.append('/home/django_projects/MyProject/myproject')
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
# Activate your virtual env
activate_env=os.path.expanduser("~/.virtualenvs/myprojectenv/bin/activate_this.py")
execfile(activate_env, dict(__file__=activate_env))
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