For background processing, queuing, or pub-sub workloads, the starter includes a pre-configured Celery stack backed by Redis.
src/project/
├── celery.py # Celery app instance & configuration
├── processor/ # Direct in-process data processor
│ ├── __init__.py
│ ├── works.py
│ └── works_test.py
└── processor_celery/ # Celery distributed task runner
├── __init__.py
├── cli.py # Worker CLI entrypoint
├── works.py # Celery task definitions
└── works_test.py # Unit tests
Celery connects to Redis using the REDIS_URL environment variable:
- Local Host (
uv run):redis://:redispassword@localhost:6379/0 - Docker Container: In
docker-compose.yml, theenvironment:section automatically routes Redis to the internalrediscontainer (redis://:redispassword@redis:6379/0).
docker compose up -d redis# Using the Typer CLI
uv run python-project-starter celery worker
# Or directly via celery
uv run celery -A project.celery.queue worker --loglevel=infoTo run the web service and background celery worker together in a single development session, supervisord.conf is provided:
uv run supervisord -c supervisord.conf