From 168541f7e22e54c2f85da4e52e162e5ba401ffcd Mon Sep 17 00:00:00 2001 From: olivier Date: Fri, 5 Jul 2024 19:11:02 +0100 Subject: [PATCH] Create a custom 500 page --- alyx/alyx/urls.py | 10 +++++ alyx/templates/error_500.html | 76 +++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 alyx/templates/error_500.html diff --git a/alyx/alyx/urls.py b/alyx/alyx/urls.py index 4fb024c78..05177bd1e 100644 --- a/alyx/alyx/urls.py +++ b/alyx/alyx/urls.py @@ -1,6 +1,8 @@ +import traceback from django.conf.urls import include from django.urls import path from django.contrib import admin +from django.shortcuts import render from rest_framework.authtoken import views as authv from rest_framework.documentation import include_docs_urls @@ -25,3 +27,11 @@ urlpatterns += [path('ibl_reports/', include('ibl_reports.urls')), ] except ModuleNotFoundError: pass + + +def handler500(request): + ctx = { + 'request': request.path, + 'traceback': traceback.format_exc() + } + return render(request, 'error_500.html', ctx) diff --git a/alyx/templates/error_500.html b/alyx/templates/error_500.html new file mode 100644 index 000000000..003a19454 --- /dev/null +++ b/alyx/templates/error_500.html @@ -0,0 +1,76 @@ + + + + + + 500 Internal Server Error + + + +
+

500 Internal Server Error

+

Oupsy, something went wrong on our end. !

+

Feel free to reach out with the information below, we'll do our best to resolve the issue.

+
+ {{ request|safe }} +
+
+ {{ traceback|safe }} +
+
+ + \ No newline at end of file