0
在谷歌應用程序引擎中由django nonrel提供支持的Django應用程序中,我有以下代碼,如果發生特定情況,應該向我發送電子郵件。但是,無論何時觸發此事件,我都會每隔大約小時左右收到一次這封電子郵件。有誰知道我可以如何讓這不會發生或導致這種情況發生?繼續收到來自GAE上Django應用程序的電子郵件
if reply_meaning==5: #not clear
text_template = get_template('email/clarify.txt')
html_template = get_template('email/clarify.html')
context = Context({
'message' : reply,
'invitation_id' : invitation.id,
})
text_message = text_template.render(context)
html_message = html_template.render(context)
message = mail.EmailMessage(
sender = to_address,
to = "MY_EMAIL_ADDRESS",
subject = "not clear",
body = text_message,
html = html_message,
)
message.send()
此代碼是否在任務隊列中?處理任務時是否有錯誤? – 2012-03-08 21:54:38
我還沒有明確地將任何東西添加到任務隊列中 - 無論如何,我並不熟悉任務隊列。錯誤是否會導致此方法重複運行? – e7mac 2012-03-08 22:07:16
默認情況下,任務隊列任務內的未捕獲異常將導致該任務重新排隊。你的錯誤日誌是否給你提示,或者你可以插入日誌記錄來查看對message.send()的調用是否多次發生? – 2012-03-08 22:13:40