Adding internal server error handler and page

This commit is contained in:
Denis-Cosmin Nutiu 2017-04-18 18:58:24 +03:00
parent 3d8fb2af0f
commit d188e140ec
3 changed files with 21 additions and 1 deletions

View file

@ -27,7 +27,9 @@ class Config:
""" """
SQLALCHEMY_TRACK_MODIFICATIONS = False SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_COMMIT_ON_TEARDOWN = True SQLALCHEMY_COMMIT_ON_TEARDOWN = True
# Url Settings # Server Settings
ADMIN_EMAIL = "example@example.com"
ADMIN_NAME = "Webmaster"
APP_IP = "0.0.0.0" APP_IP = "0.0.0.0"
APP_PORT = 5000 APP_PORT = 5000
# Pagination # Pagination

14
src/templates/500.html Normal file
View file

@ -0,0 +1,14 @@
{% extends "mybase.html" %}
{% block title %}FOTB - 500 :({% endblock %}
{% block main %}
{{ super() }}
<div class="text-center">
<h1>Oopsy poopsy...</h1>
<h2>Something bad has happened...</h2>
<div class="alert alert-danger" role="alert">
<span class="glyphicon glyphicon-fire"></span> If you want to help fixing this issue please contact <a href="mailto:{{ config.ADMIN_EMAIL }}" class="alert-link">{{ config.ADMIN_NAME }}</a>,
describing in detail how you ended on this page. <strong>Thank you</strong> very much! <span class="glyphicon glyphicon-fire"></span>
</div>
</div>
{% endblock %}

View file

@ -23,3 +23,7 @@ error_pages = flask.Blueprint('error_pages', __name__, template_folder='template
@error_pages.app_errorhandler(404) @error_pages.app_errorhandler(404)
def page_not_found_error(e): def page_not_found_error(e):
return flask.render_template("404.html"), 404 return flask.render_template("404.html"), 404
@error_pages.app_errorhandler(500)
def internal_server_error(e):
return flask.render_template("500.html"), 500