changeset 237:abc837a7e60f

gevent seems to work
author Matt Johnston <matt@ucc.asn.au>
date Wed, 06 May 2015 19:40:37 +0800
parents 88dfac30d065
children 509a1be16456
files web/templog.py web/templog.wsgi
diffstat 2 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/web/templog.py	Wed May 06 19:34:23 2015 +0800
+++ b/web/templog.py	Wed May 06 19:40:37 2015 +0800
@@ -23,6 +23,16 @@
 DATE_FORMAT = '%Y%m%d-%H.%M'
 ZOOM_SCALE = 2.0
 
+class TemplogBottle(bottle.Bottle):
+    def run(*args, **argm):
+        argm['server'] = 'gevent'
+        super(TemplogBottle, self).run(*args, **argm)
+        print "ran custom bottle"
+
+bottle.default_app.push(TemplogBottle())
+
+secure.setup_csrf()
+
 @route('/update', method='post')
 def update():
     js_enc = request.forms.data
@@ -133,16 +143,6 @@
     response.set_header('Cache-Control', "public, max-age=1296000")
     return bottle.static_file(filename, root='static')
 
-secure.setup_csrf()
-
-class TemplogBottle(Bottle):
-    def run(*args, **argm):
-        argm['server'] = 'gevent'
-        super(TemplogBottle, self).run(*args, **argm)
-        print "ran custom bottle"
-
-bottle.app().push(TemplogBottle())
-
 def main():
     #bottle.debug(True)
     #bottle.run(reloader=True)
--- a/web/templog.wsgi	Wed May 06 19:34:23 2015 +0800
+++ b/web/templog.wsgi	Wed May 06 19:40:37 2015 +0800
@@ -1,3 +1,5 @@
+from gevent import monkey; monkey.patch_all()
+
 import os
 import sys
 # Change working directory so relative paths (and template lookup) work again