This project uses Celery for background task processing and django-celery-beat for periodic task scheduling. Below are the steps and commands to get everything running for local development.
If Redis is not already installed on your system:
sudo apt update
sudo apt install redis-server -ySince systemd may not be available (e.g., in a Codespace), start Redis manually:
redis-server &redis-cli ping
# Expected output: PONGIf
redis-cliis missing:
sudo apt install redis-toolsThis runs your web application on localhost.
python3 manage.py runserverThis command starts the Django application at http://127.0.0.1:8000/.
Use it to access the Django admin panel and trigger/view task results.
This runs the Celery worker, which listens for tasks and executes them in the background.
celery -A myproject worker --loglevel=info-A myprojectrefers to the project directory containingcelery.py.--loglevel=infoshows task processing logs in the terminal.
✅ Make sure Redis is running before starting the worker.
This runs the beat service, which schedules and dispatches periodic tasks.
celery -A myproject beat --loglevel=info- This should run in a separate terminal.
- Beat uses the database schedule from the
django-celery-beatapp.
You can define and manage periodic tasks directly from the Django admin under "Periodic Tasks".
| Service | Command | Description |
|---|---|---|
| Redis Server | redis-server & |
Starts Redis manually in foreground |
| Django Server | python3 manage.py runserver |
Web server and admin access |
| Celery Worker | celery -A myproject worker --loglevel=info |
Executes background tasks |
| Celery Beat | celery -A myproject beat --loglevel=info |
Schedules and dispatches periodic tasks |