Skip to content

Instantly share code, notes, and snippets.

@GrahamDumpleton
Created July 21, 2012 00:19
Show Gist options
  • Save GrahamDumpleton/3153982 to your computer and use it in GitHub Desktop.
Save GrahamDumpleton/3153982 to your computer and use it in GitHub Desktop.
Force gevent monkey patching.
#!/usr/bin/env python
from gevent import monkey
monkey.patch_all()
import os
os.environ['GEVENT_NOPATCH'] = '1'
import newrelic.agent
newrelic.agent.initialize('/srv/socialcode/project/socialcode/newrelic.ini')
from django.core.management import execute_manager
import imp
try:
imp.find_module('settings') # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__)
sys.exit(1)
import settings
if __name__ == "__main__":
execute_manager(settings)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment