mirror of
https://github.com/ae-utbm/sith.git
synced 2024-12-22 15:51:19 +00:00
Merge pull request #456 from ae-utbm/455-sentry-modal
Updated sentry modal SDK
This commit is contained in:
commit
5e6d60bb3a
@ -1,7 +1,11 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
<script src="{{ static('core/js/sentry/bundle.min.js') }}" crossorigin="anonymous"></script>
|
||||
<script
|
||||
src="https://browser.sentry-cdn.com/7.11.1/bundle.min.js"
|
||||
integrity="sha384-qcYSo5+/E8hEkPmHFa79GRDsGT84SRhBJHRw3+dbQyh0UwueiFP1jCsRBClEREcs"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endblock head %}
|
||||
|
||||
{% block content %}
|
||||
@ -9,7 +13,15 @@
|
||||
{% if settings.SENTRY_DSN %}
|
||||
<script>
|
||||
Sentry.init({ dsn: '{{ settings.SENTRY_DSN }}' });
|
||||
Sentry.showReportDialog({ eventId: '{{ request.sentry_last_event_id() }}' })
|
||||
Sentry.showReportDialog({
|
||||
eventId: '{{ request.sentry_last_event_id() }}',
|
||||
{% if user.is_authenticated %}
|
||||
user: {
|
||||
'name': '{{user.first_name}} {{user.last_name}}',
|
||||
'email': '{{user.email}}'
|
||||
}
|
||||
{% endif %}
|
||||
})
|
||||
</script>
|
||||
{% endif %}
|
||||
{% endblock content %}
|
||||
|
@ -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 = {
|
||||
|
18
sith/urls.py
18
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)]
|
||||
|
Loading…
Reference in New Issue
Block a user