Skip to content

Commit

Permalink
custom 404
Browse files Browse the repository at this point in the history
  • Loading branch information
danielzeljko committed Dec 16, 2022
1 parent c294f32 commit 59fadc4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,14 @@ def homepage():
return render_template('home-anon.html')



@app.errorhandler(404)
def page_note_found(e):
""" Show a custom 404 page """
return render_template("404.html")



##############################################################################
# Turn off all caching in Flask
# (useful for dev; in production, this kind of stuff is typically
Expand Down
7 changes: 7 additions & 0 deletions templates/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% extends "base.html" %}

{% block content %}

<h1>404: My dog ate this page.</h1>

{% endblock content %}

0 comments on commit 59fadc4

Please sign in to comment.