Ajout d'une page d'erreur

This commit is contained in:
theo@manjaro 2022-05-13 15:17:23 +02:00
parent f4c3aa5d1a
commit 108d066711
2 changed files with 32 additions and 0 deletions

15
app.py
View File

@ -175,3 +175,18 @@ def date_select() :
context = {"dident_list":dident_list}
return render_template("date-select.html", **context)
@app.errorhandler(404)
def error(e):
"""
Affiche la page d'erreur
Parameters
----------
None.
Returns
-------
flask.render_template
"""
return render_template("error.html", error="Page non trouvée !")

17
templates/error.html Normal file
View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<title>UniSquat</title>
<link rel="stylesheet" type="text/css" href="../static/style.css">
<meta name="viewport" content="width=300, initial-scale=1" />
</head>
<body>
{% include "base.html" %}
<main>
<h2>Erreur !</h2>
<p>{{ error }}</p>
</main>
{% include "footer.html" %}
</body>
</html>