From 146e0f5ab2f696de99957b2ba7b3d9861edaa748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= Date: Sun, 9 Mar 2025 15:22:45 +0100 Subject: [PATCH] obsluga 500 --- app.py | 5 +++++ templates/500.html | 11 +++++++++++ 2 files changed, 16 insertions(+) create mode 100644 templates/500.html diff --git a/app.py b/app.py index 08081eb..06c3fb4 100644 --- a/app.py +++ b/app.py @@ -1654,6 +1654,11 @@ def server_info(id): def page_not_found(error): return render_template("404.html", error=error), 404 +@app.errorhandler(500) +def internal_server_error(error): + if app.debug: + return render_template("500.html", error=error), 500 + scheduler = BackgroundScheduler(timezone=get_localzone()) scheduler.add_job(func=scheduled_deployments, trigger="interval", minutes=1, next_run_time=datetime.now()) scheduler.add_job(func=automated_backups, trigger="interval", minutes=1, next_run_time=datetime.now()) diff --git a/templates/500.html b/templates/500.html new file mode 100644 index 0000000..f74d1b6 --- /dev/null +++ b/templates/500.html @@ -0,0 +1,11 @@ +{% extends "base.html" %} +{% block title %}500 - Błąd serwera{% endblock %} +{% block content %} +
+

500

+

Wewnętrzny błąd serwera. Przepraszamy za niedogodności.

+ {% if error %} +
{{ error }}
+ {% endif %} +
+{% endblock %}