Django error message when sending Debug = True message

Is there a way to get Django to send me error messages even if I have debugging in True?

I did not see anything in the documents.

Edit:

I'm on Django 1.2 if that matters. No, this is not a production system.

+4
source share
5 answers

You might want to check out django-sentry . It is really intended for use in production, but it has a TESTING setting so that it works with DEBUG=True . Perhaps in fact he will send emails at this moment - he did not check it himself, but at least he will keep a log of errors that you can view at any time from any device that supports the web interface.

In addition, when you eventually move on to production, it will save a life.

+3
source

If you have only one email, make sure you have a comma in the list:

 ADMINS = (('Admin', ' admin@my-domain.com '),) 

I tried these and it seems to work:

 LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'handlers': { 'mail_admins': { 'level': 'ERROR', 'class': 'django.utils.log.AdminEmailHandler' } }, 'loggers': { 'django.request': { 'handlers': ['mail_admins'], 'level': 'ERROR', 'propagate': True, }, } } 
+5
source

Just to deploy to Bob Roberts a bit, I found the default registration configuration in django.utils.log . You can simply copy and paste it into your settings, name it LOGGING and change the line:

 # settings.py: # copied from django.utils.log import DEFAULT_LOGGING LOGGING = { ... 'mail_admins': { 'level': 'ERROR', # emails for all errors #'filters': ['require_debug_false'], 'filters': [], 'class': 'django.utils.log.AdminEmailHandler' } ... } 
+2
source

I believe that you can achieve this by specifying an empty list of filters related to your AdminEmailHandler defined in your settings.py.

For instance:

 'mail_admins': { 'level': 'ERROR', 'class': 'django.utils.log.AdminEmailHandler', 'filters': [] } 

By default, filters for this class will be django.utils.log.RequireDebugFalse.

+1
source

Adding the following line to your settings.py file should help.

 LOGGING['handlers']['mail_admins']['filters'] = [] 
0
source

All Articles