7

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 amqp servers.

pinepain
  • 12,453
  • 3
  • 60
  • 65
crodjer
  • 13,384
  • 9
  • 38
  • 52

1 Answers1

6

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
  • 24,664
  • 5
  • 76
  • 70
  • 3
    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 Oct 01 '10 at 15:28
  • hi Mark, after these settings, a celeryd or celerybeat service need to be running at background as well? – icn Oct 06 '10 at 17:25
  • 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 Oct 06 '10 at 17:42
  • 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/celeryd as 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" – icn Oct 06 '10 at 18:38
  • 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 Oct 06 '10 at 18:58