Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save settipalli/4016909 to your computer and use it in GitHub Desktop.
Save settipalli/4016909 to your computer and use it in GitHub Desktop.
Django-virtualenv-wsgi-sample-configuration
# contents of a django wsgi file.
import os
import sys
SITE_PACKAGES_DIR='<absolute-path-to-virtualenv-folder>/lib/python2.7/site-packages'
DJANGO_PROJECT_PARENT_FOLDER='<absolute-path-to-django-project-folder>'
DJANGO_PROJECT_PATH='<absolute-path-to-django-project-app-folder>'
SETTINGS_FILE='settings'
# Add the virtual Python environment site-packages directory to the path
import site
site.addsitedir(SITE_PACKAGES_DIR)
sys.path = [DJANGO_PROJECT_PARENT_FOLDER] + sys.path
sys.path = [DJANGO_PROJECT_PATH] + sys.path
os.environ['DJANGO_SETTINGS_MODULE'] = SETTINGS_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