Search code examples
pythondjangodjango-templatessentryraven

Django sentry - request.sentry object


I'm trying to enable the user-feedback functionality on my project. I tried several things with no success so far. I'm using django 1.11 and raven 6.8.0

I followed this solution too - [DOCS] Django Integration for User Feedback

Debugging a little bit around the js snippet:

{% if request.sentry.id %}
    <script>
        Raven.showReportDialog({
            // grab the eventId generated by the Sentry SDK
            eventId: '{{ request.sentry.id }}',

            // use the public DSN (dont include your secret!)
            dsn: 'dsn'
        });
    </script>
{% endif %}

I noticed that there's no sentry object inside request but the request object is present in the 500.html template

Any help will be very appreciated


Solution

  • We need to improve the docs here, but see this example for how to get the request object into the 500 template:

    https://docs.sentry.io/clients/python/integrations/django/#message-references