So i'm just getting started with celery and trying to do some simple tests to get a feel for it.
Im trying to set a celery to use postgres for my backend.
on this page:
http://docs.celeryproject.org/en/latest/getting-started/first-steps-with-celery.html#keeping-results
I see the example
celery = Celery('tasks', backend='redis://localhost', broker='amqp://')
So in my code I try
celery = Celery('tasks',
backend='sqla+postgresql://celery_exp:celery_exp@myhost/celery_exp',
broker='sqla+postgresql://celery_exp:celery_exp@myhost/celery_exp',)
but i keep getting this error when starting it:
ImportError: No module named sqla+postgresql
In the docs I've tried different variations such as
postgresql://
postgresql+psycopg2://
I know that the connection string is correct besause taking out the backend paramter in the Celery constructor works as expected.
What am i doing wrong here? I feel it must be something stupid because I can't find anything on the net.
thanks in advance.
The answer lies here http://celery.readthedocs.org/en/latest/configuration.html#database-url-examples
You need to prefix your regular SQL Alchemy url string with db+
, such as
CELERY_RESULT_BACKEND = "db+postgresql+psycopg2://..."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With