views:

91

answers:

1

I am using celery for distributed task processing. I wanted to deploy my work on a web-host, just to show the working of my project. So how can i get djcelery to use a database (sqlalchemy) as backend with django instead of rabbitmq or other ampq servers.

+2  A: 

Here is the Celery docs on "Using Celery with Redis/Database as the messaging queue".

Essentially you need to install ghettoq, add it to your installed apps, add a setting CARROT_BACKEND = "ghettoq.taproot.Database" and run syncdb. Then magic happens.

Mark Lavin
hmm that worked thnx...
dcrodjer
Glad I could help. Another option which we've used for development is `CELERY_ALWAYS_EAGER = True` which just executes the tasks locally without ever sending to the queue. If you just want to run on your dev machine or do a quick demo without setting up the queue this is cheap and dirty way to get it done.
Mark Lavin
hi Mark, after these settings, a celeryd or celerybeat service need to be running at background as well?
xlione
If you are using ghettoq then yes you need celeryd running. You only need celerybeat if you have periodic tasks. If you are running `CELERY_ALWAYS_EAGER = True` you do not need celeryd running since everything will run inline.
Mark Lavin
thanks mark, when i run 'python manage.py celeryd -l INFO' at my django project derectory, it seems fine. but when i started the init script http://github.com/ask/celery/raw/master/contrib/debian/init.d/celerydas celeryd start i got this error 'celery.exceptions.ImproperlyConfigured: Celery needs to be configured to run celeryd'I have configured these # Where the Django project is. CELERYD_CHDIR="/opt/Project/" # Path to celeryd CELERYD="/opt/Project/manage.py celeryd" # Name of the projects settings module. export DJANGO_SETTINGS_MODULE="settings"
xlione
My guess would be that it's a problem with how you have defined the `DJANGO_SETTINGS_MODULE` and what directories are on your `sys.path` but I don't think the comments are the best place for this. I would open up a new question with your `/etc/default/celeryd` file and the stacktrace of the error.
Mark Lavin