2👍
✅
you can try this settings
# FOR YOUR E-MAILS
DEFAULT_FROM_EMAIL='webmaster@localhost' # or webmaster@servername
SERVER_EMAIL='root@localhost' # or 'root@servername'
EMAIL_HOST = 'localhost' # or servername
EMAIL_HOST_USER='' # or 'user@gmail.com'
EMAIL_BACKEND ='django.core.mail.backends.smtp.EmailBackend'
EMAIL_PORT = 25 #587
EMAIL_USE_TLS = True
0👍
Your settings should also contain a couple of lines for the logging purpose which sends mail when error occurs :
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
this is generated by django once you did
python manage.py startproject foobar
in your settings.py
You can have a look at it here https://docs.djangoproject.com/en/1.4/topics/logging/
Hope this will help .
- [Answered ]-Is it safe to post password without hashing it to django-rest-api?
- [Answered ]-How to create a settings.py file for an existing django project
- [Answered ]-Django Model form don't update database records
- [Answered ]-Simple socket call returning socket.gaierror: [Errno 8]
- [Answered ]-Display multiple pictures generated by matplotlib with parms from POST in Django
Source:stackexchange.com