我刚开始使用django-celery并得到了这个警告:
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.
Run Code Online (Sandbox Code Playgroud)
这是我的测试任务:
from celery.decorators import task
@task()
def myProcessingFunction():
print "Zing!"
return 1
Run Code Online (Sandbox Code Playgroud)
我从一个视图中调用它:
myProcessingFunction.delay()
Run Code Online (Sandbox Code Playgroud)
我找不到任何有关此错误的文档.这是怎么回事?
它告诉你,你正在使用的装饰器(task())将从后续版本的celery中取出,所以你应该从你的代码中删除它:
celery.task.task
should be used instead ofcelery.decorators.task`
所以
from celery.task import task # instead of celery.decorators
@task()
def myProcessingFunction():
print "Zing!"
return 1
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
815 次 |
| 最近记录: |