-
Notifications
You must be signed in to change notification settings - Fork 0
/
3_flask_templates.py
40 lines (30 loc) · 1014 Bytes
/
3_flask_templates.py
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
29
30
31
32
33
34
35
36
37
38
39
40
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route('/')
def index():
return render_template("3_home.html")
@app.route('/signup')
def signup():
"""
This view will render the simple signup page and after submitting the form, it will
redirect to the thankyou page.
"""
return render_template("3_signup.html")
@app.route('/thankyou')
def thankyou():
"""
This view will render the thank you page after user will submit the form.
It will receive the form data and display it on the page. In this case, user's
first and last name.
"""
first = request.args.get('first')
last = request.args.get('last')
return render_template("3_thankyou.html", first=first, last=last)
@app.errorhandler(404)
def page_not_found(e):
"""
Checkout the official docs at https://flask.palletsprojects.com/en/1.1.x/patterns/errorpages/
"""
return render_template("3_404.html"), 404
if __name__ == "__main__":
app.run(debug=True)