我刚启动django芹菜,收到了以下警告:
DeprecationWarning:
The `celery.decorators` module and the magic keyword arguments
are pending deprecation and will be deprecated in 2.4, then removed
in 3.0.
`task.request` should be used instead of magic keyword arguments,
and `celery.task.task` used instead of `celery.decorators.task`.
See the 2.2 Changelog for more information.
这是我的测试任务:
from celery.decorators import task
@task()
def myProcessingFunction():
print "Zing!"
return 1
我称之为
myProcessingFunction.delay()
我找不到任何有关此错误的文档。怎么回事?
它告诉您,您正在使用的装饰器(task(((将从后续版本的芹菜中删除,因此您应该将其从代码中删除:
celery.task
should be used instead of
celery.decorators.task`
所以
from celery.task import task # instead of celery.decorators
@task()
def myProcessingFunction():
print "Zing!"
return 1
根据http://docs.celeryproject.org/en/latest/internals/deprecation.html#old-任务api听起来你现在也应该更改
from celery.task import task
至
from celery import task