|
|
|
@ -56,7 +56,7 @@ css_resources = INLINE.render_css()
|
|
|
|
|
|
|
|
|
|
@app.route('/')
|
|
|
|
|
def index():
|
|
|
|
|
return render_template('index.tpl')
|
|
|
|
|
return render_template('index.html.j2')
|
|
|
|
|
|
|
|
|
|
@app.route('/picture=<num>')
|
|
|
|
|
def picture(num):
|
|
|
|
@ -67,13 +67,13 @@ def picture(num):
|
|
|
|
|
if num > pictures.count()-1:
|
|
|
|
|
num = pictures.count()-1
|
|
|
|
|
pict = pictures[num]
|
|
|
|
|
return render_template('photos.tpl', picture_path = os.path.join("static/photos", pict.file_name), numero = num )
|
|
|
|
|
return render_template('photos.html.j2', picture_path = os.path.join("static/photos", pict.file_name), numero = num )
|
|
|
|
|
|
|
|
|
|
@app.route('/all_data')
|
|
|
|
|
def all_data():
|
|
|
|
|
date_deb = datetime.utcnow()-timedelta(seconds=3600)
|
|
|
|
|
res = Data.query.filter(Data.dbdate >= date_deb)
|
|
|
|
|
return render_template('data_viz.tpl', dat=res.order_by(Data.dbdate.desc()).paginate(per_page=15))
|
|
|
|
|
return render_template('data_viz.html.j2', dat=res.order_by(Data.dbdate.desc()).paginate(per_page=15))
|
|
|
|
|
|
|
|
|
|
@app.route('/type_id=<dt>')
|
|
|
|
|
def by_data_type(dt):
|
|
|
|
@ -96,7 +96,7 @@ def by_data_type(dt):
|
|
|
|
|
|
|
|
|
|
script, div = components(data_plot)
|
|
|
|
|
|
|
|
|
|
return render_template('data_graph.tpl', dat=res.order_by(Data.dbdate.desc()).paginate(per_page=15),
|
|
|
|
|
return render_template('data_graph.html.j2', dat=res.order_by(Data.dbdate.desc()).paginate(per_page=15),
|
|
|
|
|
plot_script=script,
|
|
|
|
|
plot_div=div,
|
|
|
|
|
js_resources=js_resources,
|
|
|
|
@ -107,7 +107,7 @@ def by_data_type(dt):
|
|
|
|
|
def by_sensor(sens):
|
|
|
|
|
date_deb = datetime.utcnow()-timedelta(seconds=3600)
|
|
|
|
|
res = Data.query.filter(Data.sensor_id == sens).filter(Data.dbdate >= date_deb)
|
|
|
|
|
return render_template('data_viz.tpl', dat=res.order_by(Data.dbdate.desc()).paginate(per_page=15))
|
|
|
|
|
return render_template('data_viz.html.j2', dat=res.order_by(Data.dbdate.desc()).paginate(per_page=15))
|
|
|
|
|
|
|
|
|
|
@app.route('/configuration', methods=['GET', 'POST'])
|
|
|
|
|
def config_page():
|
|
|
|
@ -117,7 +117,7 @@ def config_page():
|
|
|
|
|
else:
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
return render_template('config_page.tpl')
|
|
|
|
|
return render_template('config_page.html.j2')
|
|
|
|
|
|
|
|
|
|
if __name__=="__main__":
|
|
|
|
|
app.run(host="0.0.0.0")
|