1、django.core.exceptions.ImproperlyConfigured: Requested setting EMAIL_FROM, but settings are not configured. You must either define the environm
ent variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
解决方案:在tasks里面加入以下代码
import os
import django
os.environ.setdefault(“DJANGO_SETTINGS_MODULE”, “dayfresh.settings”)
django.setup()
2、python manage.py runserver 之前一定要保证celery -A celery_tasks.tasks worker -l info处于运行状态,否则无法发送邮件,若执行ctrl+c则会杀死celery进程,所以要新开一个终端进行runserver
相关文章
- 03-06celery异步发邮件常见错误
- 03-06celery异步发邮件
- 03-06django、celery异步发邮件
- 03-06Django-celery-redis异步发邮件
- 03-06.NET中的异步编程——常见的错误和最佳实践