From f4dfd8f99cbc5399be2b05fbbb4360141bdbd2f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20DURR?= Date: Sat, 27 Aug 2022 19:46:26 +0200 Subject: [PATCH] settings.DEBUG variable sets the sentry env to development DSN still needs to be specified manually --- sith/settings.py | 1 + sith/urls.py | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/sith/settings.py b/sith/settings.py index 6a17446a..680859ef 100644 --- a/sith/settings.py +++ b/sith/settings.py @@ -670,6 +670,7 @@ if DEBUG: "debug_toolbar.panels.redirects.RedirectsPanel", ] SASS_INCLUDE_FOLDERS = ["core/static/"] + SENTRY_ENV = "development" if "test" in sys.argv: CAPTCHA_TEST_MODE = True diff --git a/sith/urls.py b/sith/urls.py index cdb0cabe..f824da3c 100644 --- a/sith/urls.py +++ b/sith/urls.py @@ -52,6 +52,11 @@ handler403 = "core.views.forbidden" handler404 = "core.views.not_found" handler500 = "core.views.internal_servor_error" +# Sentry Test case +if settings.DEBUG: + def trigger_error(request): + division_by_zero = 1 / 0 + urlpatterns = [ path("", include(("core.urls", "core"), namespace="core")), path("rootplace/", include(("rootplace.urls", "rootplace"), namespace="rootplace")), @@ -86,9 +91,14 @@ urlpatterns = [ path("captcha/", include("captcha.urls")), ] + + if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) import debug_toolbar urlpatterns += [path("__debug__/", include(debug_toolbar.urls))] + + # Sentry test case + urlpatterns += [path("sentry-debug/", trigger_error)]