Start celery worker throws “no attribute 'worker_state_db'”

前端 未结 4 2014
佛祖请我去吃肉
佛祖请我去吃肉 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 21:00

    The bug appears if an exception is raised while parsing settings. Such as when we set Django's SECRET_KEY (or any other setting) via an environment variable:

    SECRET_KEY = os.environ['SECRET_KEY']
    

    To solve the problem you can switch back to:

    SECRET_KEY = "asdfasdfasdf"
    

    or use:

    SECRET_KEY = os.environ.get('SECRET_KEY', '')
    

    You can also find which setting caused the problem if you comment our the following line in celery.py file and start the worker again:

    app.config_from_object('django.conf:settings', namespace='CELERY')
    

提交回复
热议问题