Ajout de page d'erreur

This commit is contained in:
theo@manjaro 2021-12-02 20:14:13 +01:00
parent 92e44f6029
commit a03f6a94eb
4 changed files with 22 additions and 1 deletions

7
app.py
View File

@ -5,8 +5,15 @@ import pages
app = Flask(__name__)
@app.route('/')
@app.route('/home')
@app.route('/home/')
def main():
return pages.main()
@app.errorhandler(404)
def error(e):
return pages.error()
if __name__=="__main__":
app.run(debug=True)

View File

@ -5,3 +5,6 @@ import definitions as lib
def main():
return render_template("main.html")
def error():
return render_template("error.html")

11
templates/error.html Normal file
View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<link href="/static/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Erreur !</h1>
<p>Retour à <a href="/home">la page d'accueil</a></p>
</body>
</html>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<link href="static/style.css" rel="stylesheet" type="text/css" />
<link href="/static/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Bienvenue !</h1>