# 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 https://testdriven.io/courses/django-celery/auto-reload/ (opens new window) to learn more.

# Demo 1

Please check http://127.0.0.1:8000/demo-celery/subscribe/ (opens new window) to see how to launch Celery task through Django form

# Demo 2

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