4 changed files with 113 additions and 0 deletions
@ -0,0 +1,35 @@ |
|||
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) |
|||
@ -0,0 +1,35 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en"> |
|||
<head> |
|||
<meta charset="UTF-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|||
<title>Document</title> |
|||
</head> |
|||
<body> |
|||
<nav> |
|||
<a href="/">Domů</a> |
|||
<a href="/o_nas">O nás</a> |
|||
<a href="/kontakt">Kontakt</a> |
|||
</nav> |
|||
|
|||
<h1>TEST VÝPISU: {{mesto}}</h1> |
|||
<p>Teplota: <b>{{teplota}}°C</b></p> |
|||
<p style="color:cyan">Vlhkost: <b>{{vlhkost}}%</b></p> |
|||
<div> Stav: {{stav}} </div> |
|||
<hr> |
|||
{% if teplota > 30 %} |
|||
<div style="background-color: lightcoral;"> |
|||
Extrémní horko! Zůstaňte ve stínu |
|||
</div> |
|||
{% elif teplota < 0 %} |
|||
<div style="background-color: #d0ffff;"> |
|||
Mrzne! Pozor na náledí |
|||
</div> |
|||
{% else %} |
|||
<div style="color: rgb(255, 0, 0); background-color: hsl(180, 100%, 50%);"> |
|||
Počasí v HTML v klidu |
|||
</div> |
|||
{% endif %} |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,24 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en"> |
|||
<head> |
|||
<meta charset="UTF-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|||
<title>Kontakt</title> |
|||
</head> |
|||
<body> |
|||
<nav> |
|||
<a href="/">Domů</a> |
|||
<a href="/o_nas">O nás</a> |
|||
<a href="/kontakt">Kontakt</a> |
|||
</nav> |
|||
|
|||
<h1>Kontaktujte nás</h1> |
|||
<p>Máte nějaké dotazy, napište nám:</p> |
|||
<ul> |
|||
<li>Email: test@example.com</li> |
|||
<li>Telfon: 12345 12345 12345</li> |
|||
<li>ICQ: 112345 11234 112345 ☺☺☺</li> |
|||
<li>Skype: examplovciCZ</li> |
|||
</ul> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,19 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en"> |
|||
<head> |
|||
<meta charset="UTF-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|||
<title>Document</title> |
|||
</head> |
|||
<body> |
|||
<nav> |
|||
<a href="/">Domů</a> |
|||
<a href="/o_nas">O nás</a> |
|||
<a href="/kontakt">Kontakt</a> |
|||
</nav> |
|||
|
|||
<h1>O nás</h1> |
|||
<p>Jsme a existujeme ☺☻☺☻☺</p> |
|||
<p>Další paragraf ♥</p> |
|||
</body> |
|||
</html> |
|||
Loading…
Reference in new issue