5
djangoのセロリを試しています。@taskデコレータに問題がありました。シェルからの私のモジュールをインポートしようとしTypeErrorの取得:セルラーのタスクデコレータで 'Module'オブジェクトが呼び出せません
python manage.py shell
:これは私が実行して、コマンドプロンプトから次のコード
from celery import task
@task
def add(x,y):
return x + y
を持っている私のcelerytest.tasksモジュールでのWindows 7上
を実行しています:
from celerytest.tasks import add
私は次のエラーを取得する:
>>> from celerytest.tasks import add
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "d:\...\celerytest\tasks.py", line 8, in <module>
@task
TypeError: 'module' object is not callable
私はこれを長年にわたってグーグルで試してみましたが、私はこの問題の世界で唯一のようです。
このインポートでは、廃止予定の警告が表示されています。より良い: 'from celery.tasks import task'。 –
変更ありがとうございます。 – vedran