This commit is contained in:
ElenaRJ 2026-06-17 16:21:07 +02:00
commit 5b622b5220

View file

@ -1,19 +1,19 @@
from flask import Flask, request, redirect
from flask import Flask, request
app = Flask(__name__)
eintraege = [] # speichert die Nachrichten (im Arbeitsspeicher)
@app.route("/")
def hello():
return "Hallo aus meiner Flask-App! Willkommen in unseren Escape Room! Wuhuuuu es wird Gruselig"
@app.route("/frage", methods=["GET", "POST"])
def frage():
@app.route("/pinnwand", methods=["GET", "POST"])
def pinnwand():
if request.method == "POST":
if request.form["antwort"] == "8":
return "Richtig!"
return "Leider falsch."
return '<form method="post">Was ist 3 + 5? ' \
'<input name="antwort"><button>OK</button></form>'
eintraege.append(request.form["nachricht"])
return redirect("/app/pinnwand")
liste = ""
for e in eintraege:
liste = liste + "<li>" + e + "</li>"
return '<h1>Pinnwand</h1>' \
'<form method="post"><input name="nachricht">' \
'<button>Senden</button></form><ul>' + liste + '</ul>'
@app.route("/pinnwand", methods=["GET", "POST"])
def pinnwand():
@ -28,4 +28,4 @@ def pinnwand():
'<button>Senden</button></form><ul>' + liste + '</ul>'
if __name__ == "__main__":
app.run(host="0.0.0.0", port=9008) # 90 + Raumnummer (Wir: 08)
app.run(host="0.0.0.0", port=9008)