feat: init python code
This commit is contained in:
1 parent
fe020b7e70
commit
535405cf99
4 files changed
+42
No files matched your search
@@ -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)
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>AudioRating</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{% block content %}{% endblock %}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
Reference in new issue
Block a user