Skip to content

Commit 10cd726

Browse files
committed
[query_parameters]
1 parent 99a1cdd commit 10cd726

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

app.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
from flask import Flask, render_template
1+
from flask import Flask, render_template, request
22

33
app = Flask(__name__)
44

55

66
@app.route('/')
77
def hello_world():
8-
return render_template('index.html')
8+
name = request.args.get('name', 'World')
9+
return render_template('index.html', name=name)
910

1011

1112
if __name__ == '__main__':

templates/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
</head>
88

99
<body>
10-
<p>Hello, World!</p>
10+
<p>Hello, {{ name }}!</p>
1111
</body>
1212
</html>

0 commit comments

Comments
 (0)