Skip to content

Instantly share code, notes, and snippets.

@matthewwithanm
Created December 11, 2010 03:40
Show Gist options
  • Save matthewwithanm/737130 to your computer and use it in GitHub Desktop.
Save matthewwithanm/737130 to your computer and use it in GitHub Desktop.
For use with django and mod_wsgi
import os, os.path
import sys
# Unless your project is already on your PYTHONPATH by default, you need to add it:
# project_directory should point to your project's parent directory.
project_directory = os.path.join(os.path.dirname(__file__), '..')
if project_directory not in sys.path:
sys.path.insert(0, project_directory)
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
# Create the wsgi application.
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
# Run the monitor
import settings
if settings.DEBUG:
try:
import monitor
monitor.start(interval=1.0)
except:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment