diff options
author | Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> | 2024-08-01 09:36:33 +0000 |
---|---|---|
committer | Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> | 2024-08-01 09:36:33 +0000 |
commit | 0abf83d77e76ac4c3ce9f4a298f6dfc10f871433 (patch) | |
tree | 2a6ba436ef09ba1cedb5b80b98bfcdd1a9a29bc9 | |
parent | 3549bf254ad34bb013f3ad20fa47c59b19a29907 (diff) |
Thu, Aug 1, 2024, 2:36 AM -07:00
-rw-r--r-- | wk9/lect/cookies/app.py | 16 | ||||
-rw-r--r-- | wk9/lect/cookies/templates/index.html | 15 | ||||
-rw-r--r-- | wk9/lect/cookies/templates/layout.html | 11 |
3 files changed, 42 insertions, 0 deletions
diff --git a/wk9/lect/cookies/app.py b/wk9/lect/cookies/app.py new file mode 100644 index 0000000..5101b69 --- /dev/null +++ b/wk9/lect/cookies/app.py @@ -0,0 +1,16 @@ +from flask import Flask, render_template, request, session + +app = Flask(__name__) + +app.config["SESSION_PERMANENT"] = False +app.config["SESSION_TYPE"] = "filesystem" +Session(app) + +@app.route("/") +def index(): + return render_template("index.html") + + +@app.route("/login") +def login(): + retur render_template("login.html") diff --git a/wk9/lect/cookies/templates/index.html b/wk9/lect/cookies/templates/index.html new file mode 100644 index 0000000..f902b58 --- /dev/null +++ b/wk9/lect/cookies/templates/index.html @@ -0,0 +1,15 @@ +{% extends "layout.html" %} + +{% block body %} + + {% if name %} + + You are logged in as {{ name }}. + + {% else %} + + You are not logged in. + + {% endif %} + +{% endblock %} diff --git a/wk9/lect/cookies/templates/layout.html b/wk9/lect/cookies/templates/layout.html new file mode 100644 index 0000000..c9965f4 --- /dev/null +++ b/wk9/lect/cookies/templates/layout.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> + +<html lang="en"> + <head> + <meta name="viewport" content="initial-scale=1, width=device-width"> + <title>hello</title> + </head> + <body> + {% block body %}{% endblock %} + </body> +</html> |