diff --git a/app.py b/app.py index 18a3fee..7146db0 100644 --- a/app.py +++ b/app.py @@ -1,10 +1,31 @@ -from flask import Flask +from flask import Flask, render_template app = Flask(__name__) @app.route("/") def home(): - return "HOLA, World!" + 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) if __name__ == "__main__": app.run(debug=True) diff --git a/templates/base.html b/templates/base.html index baeab16..c4f25fb 100644 --- a/templates/base.html +++ b/templates/base.html @@ -5,12 +5,12 @@
-