[Django]-How do you configure a Sentry raven client in a development environment to not send exceptions and still work?

10👍

Documentation didn’t say you have to set DSN value, there’s just an example how to set it.

In [1]: from raven import Client

In [2]: client = Client()
Raven is not configured (logging is disabled). Please see the documentation for more information.

In [3]: client.captureMessage('hello')  # it's a noop - no error, no capture.

It’s important to note that you should pass None (or nothing at all) as DSN parameter and not empty string, otherwise it raises InvalidDsn: Unsupported Sentry DSN scheme.

Also, if you don’t like that Raven is not configured (logging is disabled)... in your logs, you can mute it like so:

>>> import logging
>>> logging.getLogger('raven').setLevel(logging.WARNING)

20👍

We read here that we can just use an empty string DSN property.

You should not be setting DSN to an empty string, but instead in your development settings configuration don’t specify the DSN setting in the first place:

RAVEN_CONFIG = {}
👤alecxe

Leave a comment