Celeryの非同期処理中に起きたエラーをメールで通知

More than 5 years have passed since last update.

ということを以下のコードをsettings.pyに追加するだけで実現できる。便利。


settings.py


python

# Enables error emails.

CELERY_SEND_TASK_ERROR_EMAILS = True

# Name and email addresses of recipients
ADMINS = (
("George Costanza", "george@vandelay.com"),
("Cosmo Kramer", "kosmo@vandelay.com"),
)

# Email address used as sender (From field).
SERVER_EMAIL = "no-reply@vandelay.com"

# Mailserver configuration
EMAIL_HOST = "mail.vandelay.com"
EMAIL_PORT = 25



参考