Browse Source

Use gevent in run.py, as it's the case in prod

Gu1 11 years ago
parent
commit
6ac52f58bb
2 changed files with 13 additions and 1 deletions
  1. 1 0
      requirements.txt
  2. 12 1
      run.py

+ 1 - 0
requirements.txt

@@ -10,6 +10,7 @@ argparse==1.2.1
 itsdangerous==0.23
 wsgiref==0.1.2
 blinker==1.3
+gevent==0.13.8
 jsonschema==2.0.0
 requests==2.0.1
 -e git+https://github.com/kennethreitz/requests.git@947375e982482de23bf74eac7d84140126862ac5

+ 12 - 1
run.py

@@ -1,2 +1,13 @@
+import gevent.pywsgi
+from gevent import monkey; monkey.patch_all()
+import werkzeug.serving
+from werkzeug.debug import DebuggedApplication
 from ffdnispdb import app
-app.run(debug=True, threaded=True)
+
+
+@werkzeug.serving.run_with_reloader
+def runServer():
+    app.debug = True
+    ws = gevent.pywsgi.WSGIServer(('', 5000), DebuggedApplication(app, evalex=True))
+    ws.serve_forever()
+