500 error page added

This commit is contained in:
gpkvt 2023-06-04 14:35:24 +02:00
parent 89d0cfa468
commit 656932feb1
3 changed files with 27 additions and 1 deletions

10
game.py
View File

@ -69,6 +69,15 @@ def page_not_found(e):
desc = config.get('i18n', 'desc')
return render_template('404.html', title=title, lang=lang, desc=desc, theme=theme, url=url), 404
@app.errorhandler(500)
def internal_server_error(e):
lang = config.get('i18n', 'lang')
title = config.get('i18n', 'title')
url = config.get('main', 'base_url')
theme = config.get('main', 'theme')
desc = config.get('i18n', 'desc')
return render_template('500.html', title=title, lang=lang, desc=desc, theme=theme, url=url), 500
@app.route("/")
def hello():
lang = config.get('i18n', 'lang')
@ -113,6 +122,7 @@ def getContent():
return result
app.register_error_handler(404, page_not_found)
app.register_error_handler(500, internal_server_error)
if __name__ == "__main__":
from waitress import serve

View File

@ -3,7 +3,7 @@
{% block main %}
<div class="ab">
<div class="a">
<h1>404 - Page not found.</h1>
<h1>404 - Page not found</h1>
<p>Sorry, the page you requested does not exists.</p>
<p>[<a href="/">Home</a>]</p>
</div>

16
templates/500.html Normal file
View File

@ -0,0 +1,16 @@
{% extends 'base.html' %}
{% block main %}
<div class="ab">
<div class="a">
<h1>500 - Internal Server Error</h1>
<p>Sorry, the page you requested caused an internal server error.</p>
<p>[<a href="/">Home</a>]</p>
</div>
</div>
<div id="footer">
<div class="empty">&nbsp;</div>
{% include 'toggle.html' %}
<div class="empty">&nbsp;</div>
</div>
{% endblock %}