Getting TypeError: the "Module" object cannot be called in the celery task decorator

Having tried celery for django, I ran into a problem with the @task decorator. This works 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

At the command prompt, run:

python manage.py shell

Trying to import my module from the 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 have tried this for a long time, but it seems I'm the only one in the world with this problem.

+5
source share
1 answer

Well, I read 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 import as follows:

from celery.task import task

everything is working.

+9
source

All Articles