From b9e1a06e09e8b4701d324b8dd4544f25627bd5c3 Mon Sep 17 00:00:00 2001
From: "Adrian A. Baumann"
Date: Mon, 19 Jan 2026 13:52:07 +0100
Subject: [PATCH] Error pages in correct design
---
Dockerfile | 6 +++---
VorgabenUI/settings.py | 6 ++++++
argocd/deployment.yaml | 2 +-
pages/templates/400.html | 16 ++++++++++++++++
pages/templates/403.html | 21 +++++++++++++++++++++
pages/templates/404.html | 21 +++++++++++++++++++++
pages/templates/500.html | 16 ++++++++++++++++
pages/templates/base.html | 2 +-
pages/views.py | 12 ++++++++++++
9 files changed, 97 insertions(+), 5 deletions(-)
create mode 100644 pages/templates/400.html
create mode 100644 pages/templates/403.html
create mode 100644 pages/templates/404.html
create mode 100644 pages/templates/500.html
diff --git a/Dockerfile b/Dockerfile
index 9a0b276..40859f2 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM python:3.14 AS baustelle
+FROM python:3.15-rc-trixie AS baustelle
RUN mkdir /app
WORKDIR /app
ENV PYTHONDONTWRITEBYTECODE=1
@@ -7,12 +7,12 @@ RUN pip install --upgrade pip
COPY requirements.txt /app/
RUN pip install --no-cache-dir -r requirements.txt
-FROM python:3.14-slim
+FROM python:3.15-rc-slim-trixie
RUN useradd -m -r appuser && \
mkdir /app && \
chown -R appuser /app
-COPY --from=baustelle /usr/local/lib/python3.14/site-packages/ /usr/local/lib/python3.14/site-packages/
+COPY --from=baustelle /usr/local/lib/python3.15/site-packages/ /usr/local/lib/python3.15/site-packages/
COPY --from=baustelle /usr/local/bin/ /usr/local/bin/
RUN rm /usr/bin/tar /usr/lib/x86_64-linux-gnu/libncur*
WORKDIR /app
diff --git a/VorgabenUI/settings.py b/VorgabenUI/settings.py
index 9ad8140..26a43c7 100644
--- a/VorgabenUI/settings.py
+++ b/VorgabenUI/settings.py
@@ -166,6 +166,12 @@ DIAGRAM_CACHE_DIR = 'diagram_cache' # relative to MEDIA_ROOT
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
+
+# Custom error pages
+handler400 = 'pages.views.custom_400'
+handler403 = 'pages.views.custom_403'
+handler404 = 'pages.views.custom_404'
+handler500 = 'pages.views.custom_500'
DATA_UPLOAD_MAX_NUMBER_FIELDS=10250
NESTED_ADMIN_LAZY_INLINES = True
diff --git a/argocd/deployment.yaml b/argocd/deployment.yaml
index f0b7afa..cadee6d 100644
--- a/argocd/deployment.yaml
+++ b/argocd/deployment.yaml
@@ -25,7 +25,7 @@ spec:
mountPath: /data
containers:
- name: web
- image: git.baumann.gr/adebaumann/vui:0.979
+ image: git.baumann.gr/adebaumann/vui:0.980
imagePullPolicy: Always
env:
# Secret configuration
diff --git a/pages/templates/400.html b/pages/templates/400.html
new file mode 100644
index 0000000..1fee269
--- /dev/null
+++ b/pages/templates/400.html
@@ -0,0 +1,16 @@
+{% extends "base.html" %}
+
+{% block title %}Ungültige Anfrage{% endblock %}
+
+{% block content %}
+
+
+
+
Ungültige Anfrage (400)
+
Ihre Anfrage konnte nicht verarbeitet werden.
+
Bitte überprüfen Sie die eingegebenen Daten und versuchen Sie es erneut.
+
Zur Startseite
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/pages/templates/403.html b/pages/templates/403.html
new file mode 100644
index 0000000..0df887e
--- /dev/null
+++ b/pages/templates/403.html
@@ -0,0 +1,21 @@
+{% extends "base.html" %}
+
+{% block title %}Zugriff verweigert{% endblock %}
+
+{% block content %}
+
+
+
+
Zugriff verweigert (403)
+
Sie haben keine Berechtigung, auf diese Seite zuzugreifen.
+
Bitte melden Sie sich an oder wenden Sie sich an den Administrator.
+
+ Zur Startseite
+ {% if not user.is_authenticated %}
+ Anmelden
+ {% endif %}
+
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/pages/templates/404.html b/pages/templates/404.html
new file mode 100644
index 0000000..0edadba
--- /dev/null
+++ b/pages/templates/404.html
@@ -0,0 +1,21 @@
+{% extends "base.html" %}
+
+{% block title %}Seite nicht gefunden{% endblock %}
+
+{% block content %}
+
+
+
+
Seite nicht gefunden (404)
+
Die gewünschte Seite konnte nicht gefunden werden.
+
Mögliche Gründe:
+
+ - Sie haben eine falsche URL eingegeben
+ - Die Seite wurde verschoben oder gelöscht
+ - Sie haben keine Berechtigung für diese Seite
+
+
Zur Startseite
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/pages/templates/500.html b/pages/templates/500.html
new file mode 100644
index 0000000..ed89d77
--- /dev/null
+++ b/pages/templates/500.html
@@ -0,0 +1,16 @@
+{% extends "base.html" %}
+
+{% block title %}Serverfehler{% endblock %}
+
+{% block content %}
+
+
+
+
Serverfehler (500)
+
Bei der Verarbeitung Ihrer Anfrage ist ein interner Fehler aufgetreten.
+
Der Administrator wurde über dieses Problem informiert.
+
Zur Startseite
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/pages/templates/base.html b/pages/templates/base.html
index af8ebf7..e1c0b6b 100644
--- a/pages/templates/base.html
+++ b/pages/templates/base.html
@@ -219,7 +219,7 @@
-
Version {{ version|default:"0.979" }}
+
Version {{ version|default:"0.980" }}
diff --git a/pages/views.py b/pages/views.py
index 4ced651..6b09e87 100644
--- a/pages/views.py
+++ b/pages/views.py
@@ -69,3 +69,15 @@ def search(request):
return render(request,"results.html",{"suchbegriff":safe_search_term,"resultat":result})
+def custom_400(request, exception):
+ return render(request, '400.html', status=400)
+
+def custom_403(request, exception):
+ return render(request, '403.html', status=403)
+
+def custom_404(request, exception):
+ return render(request, '404.html', status=404)
+
+def custom_500(request):
+ return render(request, '500.html', status=500)
+