commit 92272c6015f3c8937a9a8ddf7fc0a69423ff5989
parent 3983a1bb5cb77e4c9c9e82b482f30752d0db2f84
Author: AsherMorgan <59518073+AsherMorgan@users.noreply.github.com>
Date: Tue, 28 Jul 2020 16:40:26 -0700
Add 404 page.
Diffstat:
3 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/Songs2Slides/routes.py b/Songs2Slides/routes.py
@@ -91,3 +91,11 @@ def lyrics():
# Return lyrics
return jsonify({"lyrics": lyrics, "errors": failed})
+
+
+
+# 404 page
+@app.errorhandler(404)
+def error404(e):
+ message = "The requested URL was not found on the server."
+ return render_template("error.html", title="404 Not Found", code="404", message=message), 404
diff --git a/Songs2Slides/static/error.js b/Songs2Slides/static/error.js
@@ -0,0 +1,5 @@
+// Finishes setting up the page
+function onLoad() {
+ // Set theme
+ UpdateTheme();
+}
diff --git a/Songs2Slides/templates/error.html b/Songs2Slides/templates/error.html
@@ -0,0 +1,12 @@
+{% extends "layout.html" %}
+
+{% block header %}
+ <script src="{{ url_for('static', filename='error.js') }}"></script>
+{% endblock header %}
+
+{% block content %}
+ <h1>{{ code }}</h1>
+ <p>{{ message }}</p>
+
+ <p><a href="{{ url_for('home') }}">Return to the homepage</a></p>
+{% endblock content %}