diff --git a/main.py b/main.py new file mode 100644 index 0000000..f6b3888 --- /dev/null +++ b/main.py @@ -0,0 +1,23 @@ +from flask import Flask, render_template, request, redirect, url_for, session + +app = Flask(__name__) +app.secret_key = "secret-key-ultra-pro-max-123" + + +@app.route("/", methods=["GET", "POST"]) +def index(): + if request.method == "POST": + session["name"] = request.form["name"].strip() + return redirect(url_for("test")) + return render_template("index.html") + + +@app.route("/test") +def test(): + if "name" not in session: + return redirect(url_for("index")) + return render_template("test.html", name=session["name"]) + + +if __name__ == "__main__": + app.run(debug=True) \ No newline at end of file diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..0ca6bb7 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,11 @@ + + + + + + AudioRating + + + {% block content %}{% endblock %} + + \ No newline at end of file diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..22a17f1 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,4 @@ +{% extends "base.html" %} +{% block content %} + +{% endblock %} \ No newline at end of file diff --git a/templates/test.html b/templates/test.html new file mode 100644 index 0000000..22a17f1 --- /dev/null +++ b/templates/test.html @@ -0,0 +1,4 @@ +{% extends "base.html" %} +{% block content %} + +{% endblock %} \ No newline at end of file