Django error email report not being sent

前端 未结 1 1604
谎友^
谎友^ 2020-12-31 14:15

I have struggling with django(1.5.1) error email reports not being sent.

here is my conf settings to use with gmail

DEFAULT_FROM_EMAIL = \'server@exa         


        
1条回答
  •  醉梦人生
    2020-12-31 14:47

    it seems that your problem is in your logging configuration: in settings.py LOGGING:

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

    This config indicate that mail_admins handler work only in DEBUG = False because the filter used. If you try with mode debug false or you can activate this handler in debug mode just comment the filters:

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

    Edit:

    Your configuration doesn't call mail_admins handler. Add it to the django logger like this:

    'loggers': {
        'django': {
            'handlers': ['file', 'console', 'mail_admins',],
            'propagate': True,
            'level': 'DEBUG',
        },
    

    0 讨论(0)
提交回复
热议问题