comparison web/templog.py @ 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
comparison
equal deleted inserted replaced
236:88dfac30d065 237:abc837a7e60f
20 import secure 20 import secure
21 import atomicfile 21 import atomicfile
22 22
23 DATE_FORMAT = '%Y%m%d-%H.%M' 23 DATE_FORMAT = '%Y%m%d-%H.%M'
24 ZOOM_SCALE = 2.0 24 ZOOM_SCALE = 2.0
25
26 class TemplogBottle(bottle.Bottle):
27 def run(*args, **argm):
28 argm['server'] = 'gevent'
29 super(TemplogBottle, self).run(*args, **argm)
30 print "ran custom bottle"
31
32 bottle.default_app.push(TemplogBottle())
33
34 secure.setup_csrf()
25 35
26 @route('/update', method='post') 36 @route('/update', method='post')
27 def update(): 37 def update():
28 js_enc = request.forms.data 38 js_enc = request.forms.data
29 mac = request.forms.hmac 39 mac = request.forms.hmac
131 @bottle.get('/<filename:re:.*\.js>') 141 @bottle.get('/<filename:re:.*\.js>')
132 def javascripts(filename): 142 def javascripts(filename):
133 response.set_header('Cache-Control', "public, max-age=1296000") 143 response.set_header('Cache-Control', "public, max-age=1296000")
134 return bottle.static_file(filename, root='static') 144 return bottle.static_file(filename, root='static')
135 145
136 secure.setup_csrf()
137
138 class TemplogBottle(Bottle):
139 def run(*args, **argm):
140 argm['server'] = 'gevent'
141 super(TemplogBottle, self).run(*args, **argm)
142 print "ran custom bottle"
143
144 bottle.app().push(TemplogBottle())
145
146 def main(): 146 def main():
147 #bottle.debug(True) 147 #bottle.debug(True)
148 #bottle.run(reloader=True) 148 #bottle.run(reloader=True)
149 bottle.run(server='cgi', reloader=True) 149 bottle.run(server='cgi', reloader=True)
150 #bottle.run(port=9999, reloader=True) 150 #bottle.run(port=9999, reloader=True)