404 page added

This commit is contained in:
gpkvt 2023-06-04 12:18:28 +02:00
parent d6c600628b
commit c1d8408cc6
6 changed files with 44 additions and 18 deletions

View File

@ -60,6 +60,12 @@ def log_the_request(response):
return 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("/") @app.route("/")
def hello(): def hello():
lang = config.get('i18n', 'lang') lang = config.get('i18n', 'lang')
@ -103,6 +109,8 @@ def getContent():
return result return result
app.register_error_handler(404, page_not_found)
if __name__ == "__main__": if __name__ == "__main__":
from waitress import serve from waitress import serve
bind = config.get('main', 'bind') bind = config.get('main', 'bind')

View File

@ -156,6 +156,11 @@ input[type="radio"] {
cursor: pointer; cursor: pointer;
} }
.empty {
width: 45%;
float: left;
}
@media only screen and (max-width:1600px) { @media only screen and (max-width:1600px) {
#content { #content {
min-width: 75%; min-width: 75%;
@ -269,6 +274,7 @@ input[type="radio"] {
.toggle { .toggle {
width: 10%; width: 10%;
height: 64px;
float: left; float: left;
display: none; display: none;
} }

12
templates/404.html Normal file
View File

@ -0,0 +1,12 @@
{% extends 'base.html' %}
{% block main %}
<div class="ab">
<div class="a">404 - Page not found.</div>
</div>
<div id="footer">
<div class="empty">&nbsp;</div>
{% include 'toggle.html' %}
<div class="empty">&nbsp;</div>
</div>
{% endblock %}

View File

@ -32,8 +32,8 @@
<div id="content"> <div id="content">
<div id="header">{{ title }}</div> <div id="header">{{ title }}</div>
<hr> <hr>
{% block main %} {%- block main %}
{% endblock %} {%- endblock %}
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
initToggle(); initToggle();