comparison web/templog.py @ 367:3db118498b97

sort out voltage logging
author Matt Johnston <matt@ucc.asn.au>
date Tue, 26 Jun 2012 08:08:48 +0800
parents 8fea6144951b
children a8ff20f15734
comparison
equal deleted inserted replaced
364:8645fdcacad1 367:3db118498b97
38 start_hour = datetime.datetime.strptime(request.query.hour, '%Y%m%d%H') 38 start_hour = datetime.datetime.strptime(request.query.hour, '%Y%m%d%H')
39 else: 39 else:
40 start_hour = datetime.datetime.now() - datetime.timedelta(days=1) 40 start_hour = datetime.datetime.now() - datetime.timedelta(days=1)
41 41
42 start = time.mktime(start_hour.timetuple()) 42 start = time.mktime(start_hour.timetuple())
43 length = int(request.query.get('length', 36)) * 3600 43 length = int(request.query.get('length', 26)) * 3600
44 44
45 response.set_header('Content-Type', 'image/png') 45 response.set_header('Content-Type', 'image/png')
46 return log.graph_png(start, length) 46 return log.graph_png(start, length)
47 47
48 @route('/') 48 @route('/')
59 f.close() 59 f.close()
60 60
61 return 'done' 61 return 'done'
62 62
63 def main(): 63 def main():
64 bottle.debug(True) 64 #bottle.debug(True)
65 bottle.run(server='cgi') 65 #bottle.run(reloader=True)
66 bottle.run(server='cgi', reloader=True)
66 #bottle.run(port=9999, reloader=True) 67 #bottle.run(port=9999, reloader=True)
67 68
68 if __name__ == '__main__': 69 if __name__ == '__main__':
69 main() 70 main()
70 71