Skip to content

Instantly share code, notes, and snippets.

@janosgyerik
Last active May 8, 2020 08:42
Show Gist options
  • Save janosgyerik/3385767 to your computer and use it in GitHub Desktop.
Save janosgyerik/3385767 to your computer and use it in GitHub Desktop.
passenger_wsgi.py for a django site
projectname = 'bashoneliners'
virtualenv_root = '/path/to/virtualenv/' + projectname
import sys
import os
INTERP = os.path.join(virtualenv_root, 'bin', 'python')
if sys.executable != INTERP:
os.execl(INTERP, INTERP, *sys.argv)
sys.path.append(os.path.join(os.getcwd(), projectname))
os.environ['DJANGO_SETTINGS_MODULE'] = projectname + '.prod_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