500 error page added
This commit is contained in:
parent
89d0cfa468
commit
656932feb1
10
game.py
10
game.py
|
@ -69,6 +69,15 @@ def page_not_found(e):
|
||||||
desc = config.get('i18n', 'desc')
|
desc = config.get('i18n', 'desc')
|
||||||
return render_template('404.html', title=title, lang=lang, desc=desc, theme=theme, url=url), 404
|
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("/")
|
@app.route("/")
|
||||||
def hello():
|
def hello():
|
||||||
lang = config.get('i18n', 'lang')
|
lang = config.get('i18n', 'lang')
|
||||||
|
@ -113,6 +122,7 @@ def getContent():
|
||||||
return result
|
return result
|
||||||
|
|
||||||
app.register_error_handler(404, page_not_found)
|
app.register_error_handler(404, page_not_found)
|
||||||
|
app.register_error_handler(500, internal_server_error)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
from waitress import serve
|
from waitress import serve
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
{% block main %}
|
{% block main %}
|
||||||
<div class="ab">
|
<div class="ab">
|
||||||
<div class="a">
|
<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>Sorry, the page you requested does not exists.</p>
|
||||||
<p>[<a href="/">Home</a>]</p>
|
<p>[<a href="/">Home</a>]</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -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"> </div>
|
||||||
|
{% include 'toggle.html' %}
|
||||||
|
<div class="empty"> </div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
Loading…
Reference in New Issue