-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstartPage.py
More file actions
28 lines (20 loc) · 794 Bytes
/
startPage.py
File metadata and controls
28 lines (20 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from flask import Flask, render_template, request
from datetime import datetime
app = Flask(__name__)
@app.route("/")
def home():
return render_template("index.html")
@app.route("/wynik", methods=["POST"])
def wynik():
rokAktualny = datetime.now().year # np. 2025
imie = request.form["imie"]
rok = request.form["rok"]
wiadomosc = request.form["wiadomosc"]
nadawca = request.form["nadawca"]
wiek = rokAktualny-int(rok)
# pobiera dane z formularza
return f"Wszystkiego najlepszego {imie} z okazji {wiek} urodzin <br> {wiadomosc}<br> {nadawca}"
if __name__ == "__main__":
#app.run(debug=True) #to jest uruchamianie lokalnie
from waitress import serve
serve(app, host='0.0.0.0', port=8080)# http://127.0.0.1:8080/ lokalny port uruchomiony