diff --git a/core/templates/core/500.jinja b/core/templates/core/500.jinja
index d9abc1a6..67962e0d 100644
--- a/core/templates/core/500.jinja
+++ b/core/templates/core/500.jinja
@@ -1,7 +1,11 @@
{% extends "core/base.jinja" %}
{% block head %}
{{ super() }}
-
+
{% endblock head %}
{% block content %}
@@ -9,7 +13,15 @@
{% if settings.SENTRY_DSN %}
{% endif %}
{% endblock content %}
diff --git a/sith/settings.py b/sith/settings.py
index 37d00a00..680859ef 100644
--- a/sith/settings.py
+++ b/sith/settings.py
@@ -643,6 +643,7 @@ SITH_MAILING_FETCH_KEY = "IloveMails"
SITH_GIFT_LIST = [("AE Tee-shirt", _("AE tee-shirt"))]
SENTRY_DSN = ""
+SENTRY_ENV = "production"
try:
from .settings_custom import *
@@ -669,13 +670,18 @@ if DEBUG:
"debug_toolbar.panels.redirects.RedirectsPanel",
]
SASS_INCLUDE_FOLDERS = ["core/static/"]
+ SENTRY_ENV = "development"
if "test" in sys.argv:
CAPTCHA_TEST_MODE = True
if SENTRY_DSN:
# Connection to sentry
- sentry_sdk.init(dsn=SENTRY_DSN, integrations=[DjangoIntegration()])
+ sentry_sdk.init(
+ dsn=SENTRY_DSN,
+ integrations=[DjangoIntegration()],
+ environment=SENTRY_ENV,
+ )
SITH_FRONT_DEP_VERSIONS = {
diff --git a/sith/urls.py b/sith/urls.py
index cdb0cabe..d8086d05 100644
--- a/sith/urls.py
+++ b/sith/urls.py
@@ -86,9 +86,27 @@ 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 debug endpoint
+
+ This function always crash and allows us to test
+ the sentry configuration and the modal popup
+ displayed to users on production
+
+ The error will be displayed on Sentry
+ inside the "development" environment
+
+ NOTE : you need to specify the SENTRY_DSN setting in settings_custom.py
+ """
+
+ def raise_exception(request):
+ division_by_zero = 1 / 0
+
+ urlpatterns += [path("sentry-debug/", raise_exception)]