Lukasz Dynowski
Lukasz Dynowski

Reputation: 13700

Celery Database Backend Missing connection string! Do you have the database_url setting set to a real value?

After upgrading to Celery 4.1.0 I got this error. While running my Django app.

Missing connection string! Do you have the database_url setting set to a real value?

Upvotes: 0

Views: 1213

Answers (1)

Lukasz Dynowski
Lukasz Dynowski

Reputation: 13700

Solution

Configuration betwean previous working version and 4.0.1 has slightly changed. Thut I hadd to specify correct url for my database backend (postgres)

Here is my config

BACKEND_URL = 'db+postgresql://'
BACKEND_URL += os.environ.get('POSTGRES_USER') + ':'
BACKEND_URL += os.environ.get('POSTGRES_PASSWORD') + '@'
BACKEND_URL += os.environ.get('POSTGRES_HOST') + ':'
BACKEND_URL += os.environ.get('POSTGRES_PORT') + '/'
BACKEND_URL += os.environ.get('POSTGRES_DB')

# celery application
celery = Celery('tasks',
   broker='amqp://guest:guest@localhost:5672',
   backend='database'
)

# backend URL
celery.conf.update(
   CELERY_RESULT_BACKEND=BACKEND_URL,
   ...
)

Upvotes: 2

Related Questions