Add custom 500 error page. Display the traceback. Center and format error page in general.

Also add a link to github for reporting the exception.
This commit is contained in:
James Taylor
2019-12-20 20:21:29 -08:00
parent 80de90b1bb
commit 98fbdf77cb
2 changed files with 39 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
import flask
import settings
import traceback
yt_app = flask.Flask(__name__)
yt_app.url_map.strict_slashes = False
@@ -30,3 +31,7 @@ def commatize(num):
if isinstance(num, str):
num = int(num)
return '{:,}'.format(num)
@yt_app.errorhandler(500)
def error_page(e):
return flask.render_template('error.html', traceback=traceback.format_exc()), 500