获取TypeError:'模块'对象不能在芹菜任务装饰器上调用 [英] Getting TypeError: 'Module' object is not callable on celery task decorator
问题描述
在我的celerytest.tasks模块中,我有以下代码
@task
def add(x,y):
return x + y
从命令提示符运行:
python manage.py shell
尝试从shell导入我的模块:
from celerytest.tasks import add
我收到以下错误:
>>>来自celerytest.tasks import add
Traceback(最近的最后一次调用):
文件< console>,第1行,< module>
文件d:\ ... \celerytest\tasks.py,第8行,< module>
@task
TypeError:'module'对象不可调用
google这个很长一段时间,但似乎我是世界上唯一有这个问题的人。
嗯,我正在阅读2.6.0 rc3的文档,但安装了2.5.3。
http://ask.github.com/celery/django/first-steps-with-django.html
当使用这样的导入时:
from celery.task import task
一切似乎都有效。
Trying out celery for django I ran into a problem with @task decorator. This is running on Windows 7.
In my celerytest.tasks module I have the following code
from celery import task
@task
def add(x,y):
return x + y
From the command prompt I run:
python manage.py shell
Trying to import my module from shell:
from celerytest.tasks import add
I get the following error:
>>> 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
I tried googling this for a long time, but it seems I am the only one in the world with this problem.
Well, I was reading the documentation for 2.6.0 rc3, but installed 2.5.3.
http://ask.github.com/celery/django/first-steps-with-django.html
When using the import like this:
from celery.task import task
everything seems to work.
这篇关于获取TypeError:'模块'对象不能在芹菜任务装饰器上调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!