Suppress admin email on django ALLOWED_HOSTS exception -


since introduction of allowed_hosts setting in django 1.4.4, lot of django error emails admin address exceptions caused silly spider looking vulnerable phpmyadmin installations or somesuch. these mails totally valid since host headers in spiders' requests indeed wrong, i'd rather have django send me error mails when important things go wrong. there simple method silence suspiciousoperation mails, or have go way , subclass commonmiddleware?

for completeness can override parts of logging: (tested on django 1.6):

logging = {     'version': 1,     'disable_existing_loggers': false,     'handlers': {         'null': {             'level': 'debug',             'class': 'logging.nullhandler',         },     },     'loggers': {         'django.security.disallowedhost': {             'handlers': ['null'],             'propagate': false,         },     }, } 

also see django security docs.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -