2011-11-23 78 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