heartbeatserver/heartbeat/frontend.py
Ruben van de Ven 73c3152e21 Initial server
2018-10-23 22:07:28 +02:00

25 lines
685 B
Python

# TODO: web frontend
import os
import tornado.web
import tornado.template
viewdir = os.path.dirname(os.path.realpath(__file__)) + '/../views'
loader = tornado.template.Loader(viewdir)
class FrontendHandler(tornado.web.RequestHandler):
def initialize(self, conn):
"""
conn: sqlite3 connection
"""
self.conn = conn
def get(self):
# c = self.conn.cursor()
# c.execute("SELECT * FROM beats ORDER BY createdAt DESC LIMIT 20")
# beats = [row for row in c]
# print(beats)
# html = loader.load("sockets.html").generate(beats=beats)
html = loader.load("plot.html").generate()
self.write(html)