obsluga 500

This commit is contained in:
Mateusz Gruszczyński 2025-03-09 15:22:45 +01:00
parent ef31984144
commit 146e0f5ab2
2 changed files with 16 additions and 0 deletions

5
app.py
View File

@ -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())

11
templates/500.html Normal file
View File

@ -0,0 +1,11 @@
{% extends "base.html" %}
{% block title %}500 - Błąd serwera{% endblock %}
{% block content %}
<div class="container text-center mt-5">
<h1 class="display-4">500</h1>
<p class="lead">Wewnętrzny błąd serwera. Przepraszamy za niedogodności.</p>
{% if error %}
<pre>{{ error }}</pre>
{% endif %}
</div>
{% endblock %}