Intro-to-Jinja-tpl-v2/app.py

32 lines
675 B
Python
Raw Normal View History

from flask import Flask, render_template
2024-02-13 12:30:45 +00:00
app = Flask(__name__)
@app.route("/")
def home():
return render_template("base.html", title= " HOLA Jinja + Flask :-)")
max_score = 100
test_name = "Py Reto "
students = [
{"name": "Sandrine", "score": 100},
{"name": "Gergeley", "score": 87},
{"name": "Frieda", "score": 92},
{"name": "Fritz", "score": 40},
{"name": "Sirius", "score": 75},
]
@app.route("/results")
def results():
context = {
"title": "Results",
"students": students,
"test_name": test_name,
"max_score": max_score,
}
return render_template("results.html", **context)
2024-02-13 12:30:45 +00:00
if __name__ == "__main__":
app.run(debug=True)