Start celery worker throws “no attribute ‘worker_state_db'”

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")

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)