2011-11-23 83 views
4

我刚开始了Django的芹菜,得到了这样的警告: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() 

我无法找到此错误的任何文档。这是怎么回事?

回答

7

它告诉你,你正在使用的装饰(任务())将被取出芹菜的后续版本,所以你应该从你的代码中删除:

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 
+0

在同样的问题来了。也许一些[芹菜文档](http://django-celery.readthedocs.org/en/latest/getting-started/first-steps-with-django.html)需要更新。 – gingerlime