comparison web/templog.py @ 236:88dfac30d065

gevent
author Matt Johnston <matt@ucc.asn.au>
date Wed, 06 May 2015 19:34:23 +0800
parents 59379b2bd056
children abc837a7e60f
comparison
equal deleted inserted replaced
235:4cbcbba567ab 236:88dfac30d065
73 return bottle.template('set', 73 return bottle.template('set',
74 inline_data = log.get_params(), 74 inline_data = log.get_params(),
75 csrf_blob = secure.get_csrf_blob(), 75 csrf_blob = secure.get_csrf_blob(),
76 allowed = allowed) 76 allowed = allowed)
77 77
78 @route('/set_current.json')
79 def set_fresh():
80 response.set_header('Content-Type', 'application/javascript')
81 return log.get_current()
82
83 @route('/') 78 @route('/')
84 def top(): 79 def top():
85 80
86 minutes = int(request.query.get('length', 26*60)) 81 minutes = int(request.query.get('length', 26*60))
87 82
138 response.set_header('Cache-Control', "public, max-age=1296000") 133 response.set_header('Cache-Control', "public, max-age=1296000")
139 return bottle.static_file(filename, root='static') 134 return bottle.static_file(filename, root='static')
140 135
141 secure.setup_csrf() 136 secure.setup_csrf()
142 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
143 def main(): 146 def main():
144 #bottle.debug(True) 147 #bottle.debug(True)
145 #bottle.run(reloader=True) 148 #bottle.run(reloader=True)
146 bottle.run(server='cgi', reloader=True) 149 bottle.run(server='cgi', reloader=True)
147 #bottle.run(port=9999, reloader=True) 150 #bottle.run(port=9999, reloader=True)