How do I include a stacktrace in my Django 500.html page?

前端 未结 5 960
孤街浪徒
孤街浪徒 2020-12-29 05:28

I\'m running Django 1.0 and I\'m close to deploying my app. As such, I\'ll be changing the DEBUG setting to False.

With that being said, I\'d still lik

5条回答
  •  太阳男子
    2020-12-29 05:45

    I know this is an old question, but these days I would recommend using a service such as Sentry to capture your errors.

    On Django, the steps to set this up are incredibly simple. From the docs:

    • Install Raven using pip install raven
    • Add 'raven.contrib.django.raven_compat' to your settings.INSTALLED_APPS.
    • Add RAVEN_CONFIG = {"dsn": YOUR_SENTRY_DSN} to your settings.

    Then, on your 500 page (defined in handler500), pass the request.sentry.id to the template and your users can reference the specific error without any of your internals being exposed.

提交回复
热议问题