Starting Celery: AttributeError: 'module' object has no attribute 'celery' Starting Celery: AttributeError: 'module' object has no attribute 'celery' python python

Starting Celery: AttributeError: 'module' object has no attribute 'celery'


I forgot to create a celery object in tasks.py:

from celery import Celeryfrom celery import task  celery = Celery('tasks', broker='amqp://guest@localhost//') #!import osos.environ[ 'DJANGO_SETTINGS_MODULE' ] = "proj.settings"@task()def add_photos_task( lad_id ):...

After that we could normally start tasks:

celery -A tasks worker --loglevel=info


For anyone who is getting the same error message for an apparently different reason, note that if any of the imports in your initialization file fail, your app will raise this totally ambiguous AttributeError rather than the exception that initially caused it.


Celery uses celery file for storing configuration of your app, you can't just give a python file with tasks and start celery.You should define celery file ( for Celery>3.0; previously it was celeryconfig.py)..

celeryd --app app.celery -l info

This example how to start celery with config file at app/celery.py

Here is example of celery file: https://github.com/Kami/libcloud-sandbox/blob/master/celeryconfig.py