Commits

Denis Bilenko committed 17eb553

rename run.py to run_standalone.py; add run_uwsgi

Comments (0)

Files changed (4)

examples/webchat/application.py

+#!/usr/bin/python
+import os
+import traceback
+from django.core.handlers.wsgi import WSGIHandler
+from django.core.signals import got_request_exception
+from django.core.management import call_command
+
+os.environ['DJANGO_SETTINGS_MODULE'] = 'webchat.settings'
+
+def exception_printer(sender, **kwargs):
+    traceback.print_exc()
+
+got_request_exception.connect(exception_printer)
+
+call_command('syncdb')
+
+application = WSGIHandler()

examples/webchat/run.py

-#!/usr/bin/python
-from gevent import monkey; monkey.patch_all()
-from gevent.wsgi import WSGIServer
-import sys
-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'] = 'webchat.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()

examples/webchat/run_standalone.py

+#!/usr/bin/python
+from gevent import monkey; monkey.patch_all()
+from gevent.wsgi import WSGIServer
+from application import application
+print 'Serving on 8000...'
+WSGIServer(('', 8000), application).serve_forever()

examples/webchat/run_uwsgi

+#!/bin/sh
+uwsgi --loop gevent --http-socket :8000 --module application --async 1000