I just deployed my Django (1.6) project with gunicorn and Nginx.
It seems to be working fine but I have one page were I\'m getting an HTTP 500 error and I can\'t find an
These are the loggers
that use mail_admins
by default (see django/utils/log.py
):
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': False,
},
'django.security': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': False,
},
you would need to change the handlers to go to the console
so that it appears in your gunicorn log rather than send emails with mail_admins
. Please note that it's not as chatty as when DEBUG=True
.
'loggers': {
'django': {
'level': 'ERROR',
'handlers': ['console'],
},
}
mail_admins
Also based on configuring logging, explicitly create a handler that calls mail_admins
; e.g. based on django/utils/log.py
:
'handlers': {
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler'
},
},
'loggers': {
'django': {
'handlers': ['mail_admins'],
},
}
This requires you to set email related settings
.
If you were not looking for solution #1, then your question is a duplicate of: How do you log server errors on django sites