Skip to content

Instantly share code, notes, and snippets.

@jordanorelli
Created April 20, 2011 00:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jordanorelli/930074 to your computer and use it in GitHub Desktop.
Save jordanorelli/930074 to your computer and use it in GitHub Desktop.
sample Django WSGI initialization script
import os
import sys
# If your project is not on your PYTHONPATH by default you can add:
path = '/path/to/project'
if path not in sys.path:
sys.path.insert(0, path)
import settings
import django.core.management
django.core.management.setup_environ(settings)
utility = django.core.management.ManagementUtility()
command = utility.fetch_command('runserver')
command.validate()
import django.conf
import django.utils
django.utils.translation.activate(django.conf.settings.LANGUAGE_CODE)
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
import projectname.monitor
projectname.monitor.start(interval = 1.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment