änderung
This commit is contained in:
parent
35e2ad2257
commit
ad5dd0e7a5
2 changed files with 19 additions and 18 deletions
19
app.py
19
app.py
|
|
@ -18,3 +18,22 @@ def frage():
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run(host="0.0.0.0", port=9006) # 90 + Raumnummer
|
app.run(host="0.0.0.0", port=9006) # 90 + Raumnummer
|
||||||
|
|
||||||
|
ffrom flask import Flask, request, redirect
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
eintraege = [] # speichert die Nachrichten (im Arbeitsspeicher)
|
||||||
|
|
||||||
|
@app.route("/pinnwand", methods=["GET", "POST"])
|
||||||
|
def pinnwand():
|
||||||
|
if request.method == "POST":
|
||||||
|
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>'
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
app.run(host="0.0.0.0", port=9006) # 90 + Raumnummer
|
||||||
18
pinnwand.py
18
pinnwand.py
|
|
@ -1,18 +0,0 @@
|
||||||
from flask import Flask, request, redirect
|
|
||||||
app = Flask(__name__)
|
|
||||||
eintraege = [] # speichert die Nachrichten (im Arbeitsspeicher)
|
|
||||||
|
|
||||||
@app.route("/pinnwand", methods=["GET", "POST"])
|
|
||||||
def pinnwand():
|
|
||||||
if request.method == "POST":
|
|
||||||
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>'
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
app.run(host="0.0.0.0", port=9006) # 90 + Raumnummer
|
|
||||||
Loading…
Reference in a new issue