forked from spseol/flask-start
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebface.py
48 lines (30 loc) · 1007 Bytes
/
webface.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from flask import Flask, render_template, request, redirect, url_for, session
import functools
# from werkzeug.security import generate_password_hash, check_password_hash
app = Flask(__name__)
app.secret_key = b"totoj e zceLa n@@@hodny retezec nejlep os.urandom(24)"
app.secret_key = b"x6\x87j@\xd3\x88\x0e8\xe8pM\x13\r\xafa\x8b\xdbp\x8a\x1f\xd41\xb8"
slova = ("Super", "Perfekt", "Úža", "Flask")
def prihlasit(function):
@functools.wraps(function)
def wrapper(*args, **kwargs):
if "user" in session:
return function(*args, **kwargs)
else:
return redirect(url_for("login", url=request.path))
return wrapper
@app.route("/", methods=["GET"])
def index():
return render_template("base.html")
@app.route("/info/")
def info():
return render_template("info.html")
@app.route("/abc/")
def abc():
return render_template("abc.html", slova=slova)
@app.route("/text/")
def text():
return """
<h1>Text</h1>
<p>toto je text</p>
"""