-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
38 lines (30 loc) · 987 Bytes
/
app.py
File metadata and controls
38 lines (30 loc) · 987 Bytes
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
from flask import Flask, render_template, redirect, url_for
app = Flask(__name__)
@app.route("/")
def home():
return render_template("index.html")
@app.route("/default")
def default():
return render_template("layout.html")
@app.route("/variable")
def var():
user = "Geeksforgeeks"
return render_template("variable_example.html", name=user)
@app.route("/if")
def ifelse():
user = "Practice GeeksforGeeks"
return render_template("if_example.html", name=user)
@app.route("/for")
def for_loop():
list_of_courses = ['Java', 'Python', 'C++', 'MATLAB']
return render_template("for_example.html", courses=list_of_courses)
@app.route("/choice/<pick>")
def choice(pick):
if pick == 'variable':
return redirect(url_for('var'))
if pick == 'if':
return redirect(url_for('ifelse'))
if pick == 'for':
return redirect(url_for('for_loop'))
if __name__ == "__main__":
app.run(debug=False)