From 5a87c482be26649c9af57e7a2a5f7eb74fb4100e Mon Sep 17 00:00:00 2001 From: Beat Bolli Date: Fri, 22 Dec 2023 23:35:36 +0100 Subject: [PATCH] add a 404 error handler --- app.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app.py b/app.py index ca6d8ae..552deed 100755 --- a/app.py +++ b/app.py @@ -25,6 +25,7 @@ request, url_for, ) +import werkzeug.exceptions from theses import theses @@ -66,5 +67,10 @@ def about(): return render_template('about.html') +@app.errorhandler(werkzeug.exceptions.NotFound) +def handle_not_found(e): + return thesis(404) + + if __name__ == '__main__': app.run()