Skip to content

Instantly share code, notes, and snippets.

@varikin
Created February 20, 2012 23:45
Show Gist options
  • Select an option

  • Save varikin/1872346 to your computer and use it in GitHub Desktop.

Select an option

Save varikin/1872346 to your computer and use it in GitHub Desktop.
Example WSGI file for mod_wsgi
import os, sys, site
# Adds the virtualenv library to the path
ENV_PATH = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
site.addsitedir(os.path.join(ENV_PATH, 'lib','python2.6','site-packages'))
# Adds the project to the path
# Note that depending on the location of this file, PROJECT_PATH might change
PROJECT_PATH = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', '..'))
sys.path.append(PROJECT_PATH)
os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings'
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