I cannot get the log to work in my Django web application.
My settings file is as follows:
EMAIL_HOST = "smtp.gmail.com" EMAIL_PORT = 465 EMAIL_HOST_USER = " paulhtremblay@gmail.com " EMAIL_HOST_PASSWORD = "password" EMAIL_USE_TLS = True DEFAULT_FROM_EMAIL = " paulhtremblay@gmail.com " SERVER_EMAIL = 'smtp.gmail.com' ADMINS = ( ('Paul Tremblay', ' paulhtremblay@gmail.com '), ) LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'handlers': { 'file': { 'level': 'ERROR', 'class': 'logging.FileHandler', 'filename': '/var/log/django_logs/debug.log' }, 'mail_admins': { 'level': 'ERROR', 'class': 'django.utils.log.AdminEmailHandler' }, }, 'loggers': { 'django': { 'handlers': ['file'], 'level': 'ERROR', 'propagate': True, }, 'django.request': { 'handlers': ['file'], 'level': 'ERROR', 'propagate': True, }, }, }
I have this in my views file:
def five_hundred_test(request): raise ValueError("raising this on purpose for testing for 500") return render(request, 'my_test/basic_css.html')
When I point my browser to this function, I get a 500 error (as expected), but nothing is sent to my email address and nothing is put into the log file. I am using Django 1.9, with python3, using Apache to start the server.
source share