Repozitář pro studenty 3.ročníku zaměření IVE
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

35 lines
953 B

from flask import Flask, render_template
import random
app = Flask(__name__)
@app.route("/")
def index():
#Simulace ESP32
teplota = round(random.uniform(-5,35),1)
vlhkost = random.randint(20,95)
mesto = "Praha"
if teplota > 25:
stav = "Je teplo, běžte k vodě ☺"
elif teplota < 5:
stav = "Je zima, opatrně venku"
else:
stav = "Počasi asi OK ☻"
return render_template("index.html",
stav = stav,
teplota=teplota, #teplota=32
vlhkost=vlhkost, #vlhkost=58
mesto=mesto) #mesto="Praha"
@app.route("/o_nas")
def o_nas():
return render_template("o_nas.html")
@app.route("/kontakt")
def kontakt():
return render_template("kontakt.html")
if __name__ == "__main__":
print("Spouštím server na http://localhost:5000 ...")
app.run(host="0.0.0.0",port=5000,debug=True)