【发布时间】:2022-01-10 09:00:26
【问题描述】:
我有使用 Celery 4.4.2 版的 Django 应用程序,它运行良好。
from celery import task
import logging
@task(ignore_result=True)
def log_user_activity(user_id):
try:
logging.info(user_id)
except Exception as e:
logging.error(str(e))
当我尝试将 Celery 版本更新到 v5.2.2 时,出现以下错误:
ImportError: cannot import name 'task' from 'celery'
有人可以帮助替换任务吗? 他们仍然有同样的例子。 https://github.com/celery/celery/blob/v5.2.2/examples/celery_http_gateway/tasks.py
【问题讨论】:
-
请将完整的错误回溯添加到您的问题中!
标签: python django django-celery