From 974d5146f584494874285a237f32c4162164e3ed Mon Sep 17 00:00:00 2001 From: Michiel Scholten Date: Fri, 22 Jul 2016 09:40:09 +0200 Subject: [PATCH] Custom 404 page --- digimarks.py | 5 +++++ templates/404.html | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100644 templates/404.html diff --git a/digimarks.py b/digimarks.py index 25847d4..63cc66b 100644 --- a/digimarks.py +++ b/digimarks.py @@ -172,6 +172,11 @@ def get_tags_for_user(userkey): return clean_tags(tags) +@app.errorhandler(404) +def page_not_found(e): + return render_template('404.html'), 404 + + @app.route('/') def index(): """ Homepage, point visitors to project page """ diff --git a/templates/404.html b/templates/404.html new file mode 100644 index 0000000..8f21320 --- /dev/null +++ b/templates/404.html @@ -0,0 +1,6 @@ +{% extends "base.html" %} +{% block title %}404: Page not found{% endblock %} +{% block pageheader %}404: Page not found{% endblock %} +{% block pagecontent %} +The page you requested was not found. +{% endblock %}