开发者

How come Django doesn't email me errors when my DEBUG = False?

开发者 https://www.devze.com 2023-02-07 05:13 出处:网络
ADMINS = [(\"alex\", \"alex@mydomain.com\"), (\"matt\", \"matt@mydomain.com\")] DEBUG = False How come Django doesn\'t email me errors? I set up the email settings correctly, and everything else ca
ADMINS = [("alex", "alex@mydomain.com"), ("matt", "matt@mydomain.com")]

DEBUG = False

How come Django doesn't email me errors? I set up the email settings correctly, and everything else can send email just fine.

EMAIL_HOST = "mail.blah.com"
EMAIL_PORT = 25
EMAIL_H开发者_运维知识库OST_USER = "blah"
EMAIL_HOST_PASSWORD = "blah"
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = "blah@blah.com"

I want to be emailed all errors that occurred. (even though I have my own try /except blocks everywhere).


From django documentation on error-reporting:

By default, Django will send e-mail from root@localhost. However, some mail providers reject all e-mail from this address. To use a different sender address, modify the SERVER_EMAIL setting.

Maybe this will help you.


One thing I've found that helps me debug the email subsystem in django is a setup that displays the email content (headers and all) to standard out. I've summarized below, but you can also find more info about in the django documentation (link below). Not sure if it will help you in your case, but it might help debug the issue ... help you see what's being sent.

Set the following in settings.py

EMAIL_HOST = "localhost"
EMAIL_PORT = 1025

Run the following to host the test webserver

python -m smtpd -n -c DebuggingServer localhost:1025

Django documentation: http://docs.djangoproject.com/en/dev/topics/email/

0

精彩评论

暂无评论...
验证码 换一张
取 消