From c1d8408cc6891f31720b4f68e0dd0bf1c5e8b429 Mon Sep 17 00:00:00 2001 From: gpkvt Date: Sun, 4 Jun 2023 12:18:28 +0200 Subject: [PATCH] 404 page added --- game.py | 8 ++++++++ static/css/base.css | 6 ++++++ templates/404.html | 12 ++++++++++++ templates/base.html | 4 ++-- templates/index.html | 2 +- templates/toggle.html | 30 +++++++++++++++--------------- 6 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 templates/404.html diff --git a/game.py b/game.py index 85a757e..495fc51 100755 --- a/game.py +++ b/game.py @@ -60,6 +60,12 @@ def log_the_request(response): return response +@app.errorhandler(404) +def page_not_found(e): + lang = config.get('i18n', 'lang') + title = config.get('i18n', 'title') + return render_template('404.html', title=title, lang=lang), 404 + @app.route("/") def hello(): lang = config.get('i18n', 'lang') @@ -103,6 +109,8 @@ def getContent(): return result +app.register_error_handler(404, page_not_found) + if __name__ == "__main__": from waitress import serve bind = config.get('main', 'bind') diff --git a/static/css/base.css b/static/css/base.css index d6af937..46c521c 100644 --- a/static/css/base.css +++ b/static/css/base.css @@ -156,6 +156,11 @@ input[type="radio"] { cursor: pointer; } +.empty { + width: 45%; + float: left; +} + @media only screen and (max-width:1600px) { #content { min-width: 75%; @@ -269,6 +274,7 @@ input[type="radio"] { .toggle { width: 10%; + height: 64px; float: left; display: none; } diff --git a/templates/404.html b/templates/404.html new file mode 100644 index 0000000..98735f2 --- /dev/null +++ b/templates/404.html @@ -0,0 +1,12 @@ +{% extends 'base.html' %} + +{% block main %} +
+
404 - Page not found.
+
+ +{% endblock %} diff --git a/templates/base.html b/templates/base.html index 09d825f..e5b33a0 100644 --- a/templates/base.html +++ b/templates/base.html @@ -32,8 +32,8 @@

- {% block main %} - {% endblock %} +{%- block main %} +{%- endblock %}