Django错误通知电子邮件转到不正确的收件人

时间:2013-07-24 13:58:11

标签: django

我想让Django给我发电子邮件500个错误。我已根据需要关闭DEBUG模式,并发送到本地SMTP服务器。我正在使用Python 2.7.2和Django 1.5.1。

Django正在使用不正确和无效的收件人“n,e”发送:

# python -m smtpd -n -c DebuggingServer localhost:25
---------- MESSAGE FOLLOWS ----------
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [Django] ERROR (EXTERNAL IP): Internal Server Error: /
From: sender@example.com
To: n, e

从settings.py中提取:

ADMINS = (
    ('Me', 'me@example.com')
)

SEND_BROKEN_LINK_EMAILS = True

MANAGERS = ADMINS
SERVER_EMAIL = 'sender@example.com'

1 个答案:

答案 0 :(得分:3)

ADMINS = (
    ('Me', 'me@example.com'),
    #                       ^ missing comma
)

括号不创建元组,逗号(和空括号):

>> 1 == (1)
True

>> a = 1,
>> a == (1,)
True

有关说明,请参阅Tuple Syntax