Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Developing with Django+Celery without running `celeryd`?

In development, it's a bit of a hassle to run the celeryd as well as the Django development server. Is it possible to, for example, ask celery to run tasks synchronously during development? Or something similar?

like image 270
David Wolever Avatar asked Oct 06 '10 15:10

David Wolever


People also ask

Can we use Celery without Django?

Yes you can. Celery is a generic asynchronous task queue. In place of "django_project" you would point to your module.

How do I start Celery beat Django?

This command has used for start the celery beat. Firstly add the django_celery_beat module in installed apps in settings file. And then apply the django migrate command, this will create the tables in admin pannel. After completing all the process like in celery file and create task in tasks.py .


2 Answers

Yes you can do this by setting CELERY_TASK_ALWAYS_EAGER = True in your settings.
(Constant was previously called CELERY_ALWAYS_EAGER) http://docs.celeryproject.org/en/latest/userguide/configuration.html#task-execution-settings

like image 195
Mark Lavin Avatar answered Oct 14 '22 04:10

Mark Lavin


There's also a custom Django test runner in django-celery that helps with CELERY_ALWAYS_EAGER. Read more about using Celery with Django on the docs.

like image 23
tobych Avatar answered Oct 14 '22 04:10

tobych