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

后端 未结 6 1353
南旧
南旧 2021-02-04 02:33

I try to start a Celery worker server from a command line:

celery -A tasks worker --loglevel=info

The code in tasks.py:

import          


        
6条回答
  •  迷失自我
    2021-02-04 03:03

    Try start celery:

    celeryd --config=my_app.my_config --loglevel=INFO --purge -Q my_queue

    There is next script in my tasks.py:

    @task(name="my_queue", routing_key="my_queue")
    def add_photos_task( lad_id ):
    

    There is next script in my_config.py:

    CELERY_IMPORTS = \
    (
        "my_app.tasks",
    )
    CELERY_ROUTES = \
    {
        "my_queue":
        {
            "queue": "my_queue"
        },
    }
    CELERY_QUEUES = \
    {
        "my_queue":
        {
            "exchange": "my_app",
            "exchange_type": "direct",
            "binding_key": "my_queue"
        },
    }
    celery = Celery(broker='amqp://guest@localhost//')
    

提交回复
热议问题