From 4f5013460f2bd85e8e8f95f8022bf4553e5d82be Mon Sep 17 00:00:00 2001 From: coolneng Date: Fri, 12 Jun 2020 22:50:08 +0200 Subject: [PATCH] Add custom error pages --- app/errors.py | 12 ++++++++++++ app/templates/404.html | 6 ++++++ app/templates/500.html | 8 ++++++++ app/templates/visualization.html | 9 +++++++++ 4 files changed, 35 insertions(+) create mode 100644 app/errors.py create mode 100644 app/templates/404.html create mode 100644 app/templates/500.html create mode 100644 app/templates/visualization.html diff --git a/app/errors.py b/app/errors.py new file mode 100644 index 0000000..b273a65 --- /dev/null +++ b/app/errors.py @@ -0,0 +1,12 @@ +from flask import render_template +from app import app + + +@app.errorhandler(404) +def not_found_error(error): + return render_template("404.html"), 404 + + +@app.errorhandler(500) +def internal_error(error): + return render_template("500.html"), 500 diff --git a/app/templates/404.html b/app/templates/404.html new file mode 100644 index 0000000..0bac211 --- /dev/null +++ b/app/templates/404.html @@ -0,0 +1,6 @@ +{% extends "base.html" %} + +{% block app_content %} +

Sorry, we couldn't find that

+

Back

+{% endblock %} diff --git a/app/templates/500.html b/app/templates/500.html new file mode 100644 index 0000000..984d38c --- /dev/null +++ b/app/templates/500.html @@ -0,0 +1,8 @@ +{% extends "base.html" %} + +{% block app_content %} +

An unexpected error has occurred

+

The administrator has been notified!

+

If he gets too many notifications, we might replace him with an AI

+

Back

+{% endblock %} diff --git a/app/templates/visualization.html b/app/templates/visualization.html new file mode 100644 index 0000000..bb7c02a --- /dev/null +++ b/app/templates/visualization.html @@ -0,0 +1,9 @@ +{% extends "base.html" %} +{% import 'bootstrap/wtf.html' as wtf %} + +{% block app_content %} +

Dataset visualization

+Image Placeholder +Image Placeholder +

Back

+{% endblock %}