26 lines
685 B
Python
26 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)
|