Search code examples
sentryraven

raven - sentry + django = No servers configured, and sentry not installed. Cannot send message


I have a sentry server that works ok.

raven test <dnstoserver> -> Sending a test message... success!

I have a dev machine with django 1.3 and raven 1.93. In the django project I have this:

setting.py:

SENTRY_KEY=<secretkey>
SENTRY_DNS=<dnstoserver>

INSTALLED_APPS = (
    'bar',
    'foo',
    'raven.contrib.django',
)

LOGGING = {
    'version': 1,
    'disable_existing_loggers': True,
    'root': {
        'level': 'WARNING',
        'handlers': ['sentry'],
    },
    'formatters': {
        'verbose': {
            'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
        },
    },
    'handlers': {
        'sentry': {
            'level': 'ERROR',
            'class': 'raven.contrib.django.handlers.SentryHandler',
        },
        'console': {
            'level': 'DEBUG',
            'class': 'logging.StreamHandler',
            'formatter': 'verbose'
        }
    },
    'loggers': {
        'django.db.backends': {
            'level': 'ERROR',
            'handlers': ['console'],
            'propagate': False,
        },
        'raven': {
            'level': 'DEBUG',
            'handlers': ['console', 'sentry'],
            'propagate': False,
        },        
    },
}

Mind the absence of 'sentry' in the installed_apps. This is intentionally, since sentry is the server and should not be on a client!

views.py (in a view):

import logging
logger = logging.getLogger("raven")
logger.error("test")

When I run the view I get on the console:

No servers configured, and sentry not installed. Cannot send message

Why, and how to fix?


Solution

  • Were you really setting SENTRY_DNS or SENTRY_DSN?

    When you set SENTRY_DSN the instantiation of the major config variables happens automatically (including SENTRY_SERVERS, SENTRY_PUBLIC_KEY, SENTRY_SECRET_KEY, and SENTRY_PROJECT)