Search code examples
djangocelerydjango-celery

How can celery use Django ORM?


How can celery use Django ORM?

Celery and django are diffent processes. But, Celery worker can use Django Application code.(ORM, Model..) I think celery process have django application code. Is it right?

What should I do setting when django and celery on another server physically? I was wondering how Celery can use the code in the django.


Solution

  • The server where the Celery workers run on still needs to have the task code (likely your application), even if it's not running a web/application server to serve pages to clients.

    Then, it's just an issue of configuring your Django DATABASES setting on the Celery-worker running box so it's able to connect to the same database (and caches, etc., as necessary).