Created
March 7, 2011 20:21
-
-
Save powellc/859135 to your computer and use it in GitHub Desktop.
A development script to run django with gevent instead of flup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys | |
sys.path.append('<path_to_virtualenv>') | |
from gevent import monkey; monkey.patch_all() | |
from gevent.wsgi import WSGIServer | |
import os | |
import traceback | |
from django.core.handlers.wsgi import WSGIHandler | |
from django.core.management import call_command | |
from django.core.signals import got_request_exception | |
sys.path.append('..') | |
os.environ['DJANGO_SETTINGS_MODULE'] = '<project name>.settings' | |
def exception_printer(sender, **kwargs): | |
traceback.print_exc() | |
got_request_exception.connect(exception_printer) | |
call_command('syncdb') | |
print 'Serving on 8088...' | |
WSGIServer(('', 8088), WSGIHandler()).serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment