Changeset - 843b24c63ab7
[Not reviewed]
0 1 0
Ben Sturmfels (bsturmfels) - 1 month ago 2021-11-29 03:21:14
ben@sturm.com.au
Don't send email notification on DisallowedHost error.
1 file changed with 43 insertions and 4 deletions:
0 comments (0 inline, 0 general)
www/conservancy/settings.py
Show inline comments
...
 
@@ -41,7 +41,46 @@ TEMPLATE_DIRS = (
 
)
 
del _root_dir
 

	
 
# try:
 
#     from djangodebug import conservancy_hostname as FORCE_CANONICAL_HOSTNAME
 
# except:
 
#     pass
 
LOGGING = {
 
    'version': 1,
 
    'disable_existing_loggers': False,
 
    'formatters': {
 
        'default': {
 
            'format': '%(asctime)s %(levelname)s %(name)s: %(message)s',
 
            'datefmt': '%Y-%m-%d %H:%M:%S',
 
        },
 
    },
 
    'filters': {
 
        'require_debug_false': {
 
            '()': 'django.utils.log.RequireDebugFalse'
 
        }
 
    },
 
    'handlers': {
 
        'mail_admins': {
 
            'level': 'ERROR',
 
            'filters': ['require_debug_false'],
 
            'class': 'django.utils.log.AdminEmailHandler'
 
        },
 
        'console': {
 
            'level': 'DEBUG',
 
            'class': 'logging.StreamHandler',
 
            'formatter': 'default',
 
        },
 
    },
 
    'loggers': {
 
        'django.request': {
 
            'handlers': ['mail_admins'],
 
            'level': 'ERROR',
 
            'propagate': True,
 
        },
 
        # Avoid email notification on DisallowedHost error.
 
        'django.security.DisallowedHost': {
 
            'handlers': ['console'],
 
            'propagate': False,
 
        },
 
    },
 
    'root': {
 
        'handlers': ['console'],
 
        'level': 'INFO',
 
    },
 
}
0 comments (0 inline, 0 general)