# -*- coding: utf-8 -*- """ Created on Thu Aug 17 22:25:52 2017 @author: arofarn """ ########### # IMPORTS # ########### from cameteo import * from flask import render_template from flask_bootstrap import Bootstrap from flask_nav import Nav from flask_nav.elements import * ######## # MAIN # ######## bootstrap = Bootstrap(app) nav = Nav() nav.init_app(app) navbar = Navbar('Camétéo', View('Accueil', 'index'), Subgroup('Par données', View("Température de l'air", 'by_data_type', dt='TA'), View("Humidité relative", 'by_data_type', dt='HR'), View("Pression atmosphérique",'by_data_type', dt='PA'), ), Subgroup('Par capteur', View("Capteur BME280", 'by_sensor', sens = 'AdaBME280_1') ) ) nav.register_element('top', navbar) @app.route('/') def index(): date_deb = datetime.utcnow()-timedelta(seconds=3600) res = Data.query.filter(Data.dbdate >= date_deb) return render_template('index.html', dat=res.order_by(Data.dbdate.desc()).paginate(per_page=15)) @app.route('/type_id=