Start celery worker throws “no attribute 'worker_state_db'”

前端 未结 4 2053
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-03 20:46

When I am trying to start celery worker in Django app as:

celery -A myApp worker -l info

I get following error:

File \"/hom         


        
4条回答
  •  醉酒成梦
    2021-01-03 20:46

    I would like to add two things:

    1. This is also true when you load settings from any configuration file, not essentially django's. The question is related purely to Celery.

    2. Some explanation on origins of this cryptic error:

    worker_state_db is a setting with a default value, so you shouldn't have to set it manually. An exception is raised because Settings are just empty and don't have any values, even the default ones. That said, we don't have the default config loaded. Somehow in Celery, the exception from parsing (the original one which caused the problem) is not propagated to the stderr when starting a worker. Hence, you get a message which doesn't tell you anything about a possible solution.

    How to fix it? For example, if you have celeryconfig.py where your celery app module is placed and you load settings from there via:

    app.config_from_object('path.to.your.celery.module.celeryconfig')
    

    Check your whole celeryconfig.py file for anything that could crash or cause the parser to crash (incompatible settings values?).

提交回复
热议问题