Adventure aus DB
This commit is contained in:
parent
cb4541ed5b
commit
2ae436cfd8
1 changed files with 0 additions and 41 deletions
41
app/app.py
41
app/app.py
|
|
@ -12,48 +12,7 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
from flask import Flask, request
|
from flask import Flask, request
|
||||||
|
|
||||||
app = Flask(__name__)
|
|
||||||
|
|
||||||
@app.route("/")
|
|
||||||
def hello():
|
|
||||||
return "Hallo aus meiner Flask-App!"
|
|
||||||
|
|
||||||
@app.route("/frage", methods=["GET", "POST"])
|
|
||||||
def frage():
|
|
||||||
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>'
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
app.run(host="0.0.0.0", port=9011)
|
|
||||||
|
|
||||||
|
|
||||||
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=9011)
|
|
||||||
|
|
||||||
|
|
||||||
from flask import Flask
|
|
||||||
import sqlite3
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue