diff options
-rw-r--r-- | wk9/lect/hello/app.py | 7 | ||||
-rw-r--r-- | wk9/lect/hello/templates/index.html | 2 |
2 files changed, 3 insertions, 6 deletions
diff --git a/wk9/lect/hello/app.py b/wk9/lect/hello/app.py index 0ca93b3..1368586 100644 --- a/wk9/lect/hello/app.py +++ b/wk9/lect/hello/app.py @@ -4,8 +4,5 @@ app = Flask(__name__) @app.route("/") def index(): - if "name" in request.args: - name = request.args["name"] - else: - name = "world" - return render_template("index.html", placeholder=name) + name = request.args.get("name", "world") + return render_template("index.html", name=name) diff --git a/wk9/lect/hello/templates/index.html b/wk9/lect/hello/templates/index.html index 9870414..7e90e67 100644 --- a/wk9/lect/hello/templates/index.html +++ b/wk9/lect/hello/templates/index.html @@ -6,6 +6,6 @@ <title>hello</title> </head> <body> - hello, {{ placeholder }} + hello, {{ name }} </body> </html> |