All routing logic in app.py are working correctly.
This commit is contained in:
+11
-1
@@ -2,10 +2,17 @@ from flask import Flask, request, render_template, url_for, redirect
|
|||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/", methods=['GET', 'POST'])
|
||||||
def groclist_home():
|
def groclist_home():
|
||||||
|
error = None
|
||||||
|
if request.method == 'POST':
|
||||||
|
if request.form.get('login') == 'Inloggen':
|
||||||
|
return redirect(url_for('groclist_login'))
|
||||||
|
elif request.method == 'GET':
|
||||||
return render_template('index.html')
|
return render_template('index.html')
|
||||||
|
|
||||||
|
return render_template('index.html',error=error)
|
||||||
|
|
||||||
@app.route("/welcome")
|
@app.route("/welcome")
|
||||||
def groclist_welcome():
|
def groclist_welcome():
|
||||||
return render_template("welcome.html")
|
return render_template("welcome.html")
|
||||||
@@ -20,6 +27,9 @@ def groclist_login():
|
|||||||
return redirect(url_for('groclist_welcome'))
|
return redirect(url_for('groclist_welcome'))
|
||||||
return render_template("login.html", error=error)
|
return render_template("login.html", error=error)
|
||||||
|
|
||||||
|
|
||||||
|
app.add_url_rule("/welcome", "welcome", groclist_welcome)
|
||||||
|
|
||||||
# start server with run method
|
# start server with run method
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run(debug=True)
|
app.run(debug=True)
|
||||||
|
|||||||
@@ -11,4 +11,7 @@
|
|||||||
<p class="important">
|
<p class="important">
|
||||||
Welkom bij Groclist
|
Welkom bij Groclist
|
||||||
</p>
|
</p>
|
||||||
|
<form method="post" action="/">
|
||||||
|
<input type="submit" value="Inloggen" name="login"/>
|
||||||
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user