Last active
June 23, 2018 02:15
-
-
Save frodo821/6616da56252d01b118970dc952933b7e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
from flask import Flask, request, render_template | |
app = Flask(__name__) | |
temperature = float("NaN") | |
pressure = float("NaN") | |
humidity = float("NaN") | |
@app.route("/",methods=['POST']) | |
def info(): | |
global temperature, pressure, humidity | |
temperature = float(request.form['temp']) | |
pressure = float(request.form['pres']) | |
humidity = float(request.form['hum']) | |
return render_template('index.html', | |
t=temperature, | |
h=humidity, | |
p=pressure) | |
@app.route("/", methods=["GET"]) | |
def view(): | |
return render_template('index.html', | |
t=temperature, | |
h=humidity, | |
p=pressure) | |
if __name__ == "__main__": | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment