From 535405cf9941961162e0cd153dfa2ff07a4b9a4d Mon Sep 17 00:00:00 2001 From: Robin Schanbacher Date: Sat, 31 Oct 2026 19:58:06 +0100 Subject: [PATCH] feat: init python code --- main.py | 23 +++++++++++++++++++++++ templates/base.html | 11 +++++++++++ templates/index.html | 4 ++++ templates/test.html | 4 ++++ 4 files changed, 42 insertions(+) create mode 100644 main.py create mode 100644 templates/base.html create mode 100644 templates/index.html create mode 100644 templates/test.html 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