sentry: deal with sentry's js as external resource

This commit is contained in:
Antoine Bartuccio 2018-10-10 15:27:21 +02:00
parent bdd8427758
commit f4122bbc37
3 changed files with 9 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,12 +1,16 @@
{% extends "core/base.jinja" %} {% extends "core/base.jinja" %}
{% block head %} {% block head %}
{{ super() }} {{ super() }}
{% if settings.EXTERNAL_RES %}
<script src="https://browser.sentry-cdn.com/4.0.6/bundle.min.js" crossorigin="anonymous"></script> <script src="https://browser.sentry-cdn.com/4.0.6/bundle.min.js" crossorigin="anonymous"></script>
{% else %}
<script src="{{ static('core/js/sentry/bundle.min.js') }}" crossorigin="anonymous"></script>
{% endif %}
{% endblock head %} {% endblock head %}
{% block content %} {% block content %}
<h3>{% trans %}500, Server Error{% endtrans %}</h3> <h3>{% trans %}500, Server Error{% endtrans %}</h3>
{% if request.sentry_dsn %} {% if settings.SENTRY_DSN %}
<script> <script>
Sentry.init({ dsn: '{{ request.sentry_dsn }}' }); Sentry.init({ dsn: '{{ request.sentry_dsn }}' });
Sentry.showReportDialog({ eventId: '{{ request.sentry_last_event_id() }}' }) Sentry.showReportDialog({ eventId: '{{ request.sentry_last_event_id() }}' })

View File

@ -72,7 +72,6 @@ def not_found(request):
def internal_servor_error(request): def internal_servor_error(request):
request.sentry_dsn = settings.SENTRY_DSN
request.sentry_last_event_id = last_event_id request.sentry_last_event_id = last_event_id
return HttpResponseServerError(render(request, "core/500.jinja")) return HttpResponseServerError(render(request, "core/500.jinja"))