diff options
author | Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> | 2024-07-09 08:49:01 +0000 |
---|---|---|
committer | Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> | 2024-07-09 08:49:01 +0000 |
commit | 37a731b6ebaab06b2ccd192c8847f86fcd951b01 (patch) | |
tree | 43f2cbb71f38cd441e27aaeccb2c39762cfa5c28 | |
parent | 04f63687b84f26e4459b28a54b4bee680bc2206c (diff) |
Tue, Jul 9, 2024, 1:49 AM -07:00
-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> |