settings.DEBUG variable sets the sentry env to development

DSN still needs to be specified manually
This commit is contained in:
Théo DURR 2022-08-27 19:46:26 +02:00
parent 29139bf360
commit f4dfd8f99c
No known key found for this signature in database
GPG Key ID: 708858E9F7281E30
2 changed files with 11 additions and 0 deletions

View File

@ -670,6 +670,7 @@ if DEBUG:
"debug_toolbar.panels.redirects.RedirectsPanel", "debug_toolbar.panels.redirects.RedirectsPanel",
] ]
SASS_INCLUDE_FOLDERS = ["core/static/"] SASS_INCLUDE_FOLDERS = ["core/static/"]
SENTRY_ENV = "development"
if "test" in sys.argv: if "test" in sys.argv:
CAPTCHA_TEST_MODE = True CAPTCHA_TEST_MODE = True

View File

@ -52,6 +52,11 @@ handler403 = "core.views.forbidden"
handler404 = "core.views.not_found" handler404 = "core.views.not_found"
handler500 = "core.views.internal_servor_error" handler500 = "core.views.internal_servor_error"
# Sentry Test case
if settings.DEBUG:
def trigger_error(request):
division_by_zero = 1 / 0
urlpatterns = [ urlpatterns = [
path("", include(("core.urls", "core"), namespace="core")), path("", include(("core.urls", "core"), namespace="core")),
path("rootplace/", include(("rootplace.urls", "rootplace"), namespace="rootplace")), path("rootplace/", include(("rootplace.urls", "rootplace"), namespace="rootplace")),
@ -86,9 +91,14 @@ urlpatterns = [
path("captcha/", include("captcha.urls")), path("captcha/", include("captcha.urls")),
] ]
if settings.DEBUG: if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
import debug_toolbar import debug_toolbar
urlpatterns += [path("__debug__/", include(debug_toolbar.urls))] urlpatterns += [path("__debug__/", include(debug_toolbar.urls))]
# Sentry test case
urlpatterns += [path("sentry-debug/", trigger_error)]