Skip to main content

Background Task with Celery

Run Celery Worker

# please make sure you already set env variable for Celery message broker and result backend
(venv)$ watchfiles --filter python 'celery -A django_app worker --loglevel=info'

--filter python means watchfiles will only monitor Python file code change.

This command can auto reload Celery worker on code change, which is very convenient in the development.

You can check to learn more.

Demo 1

Please check to see how to launch Celery task through Django form

Demo 2

Please check django_app/users/ to see how to launch Celery task to update user avatar when user signup