A Django RESTful API for managing personal or team tasks β featuring PostgreSQL, RabbitMQ, Celery, and Nginx in a Dockerized production setup.
π View Test Coverage Report
- β Django 5 + Django REST Framework
- β PostgreSQL database (Dockerized)
- β RabbitMQ for background tasks (Celery-integrated)
- β Celery task queue for async logging
- β Gunicorn for WSGI-based production serving
- β Nginx reverse proxy for HTTP routing and static file delivery
- β
Environment config with
.envandpython-decouple - β Swagger UI for API documentation
- β Docker & Docker Compose for development and deployment
- β Pytest-based testing with coverage reporting
taskflow-api/
βββ taskflow_api/ # Django project (with celery.py)
βββ tasks/ # App: models, views, serializers, signals, celery tasks
βββ tests/ # Pytest tests for models, views, celery
βββ Dockerfile # Docker image for Django (Gunicorn inside)
βββ docker-compose.yml # Full stack (Django, DB, Celery, Nginx, RabbitMQ)
βββ nginx.conf # Nginx config for reverse proxy
βββ .env # Environment variables
βββ logs/ # Log folder (created if missing)
βββ requirements.txt # Python dependencies
βββ run_server.sh # Start all services in production mode
βββ start-dev-services.sh # Run only DB & RabbitMQ for local development
βββ lint-clean.sh # Format & lint Python code using Ruff
βββ pytest.ini # Pytest configuration
- Python 3.12+
- Docker & Docker Compose
- (Optional) Virtualenv for local development
python3 -m venv env
source env/bin/activate
pip install -r requirements.txtCopy the .env.example file and rename it to .env .
Run Django and Celery locally. Use Docker for DB & RabbitMQ only.
make dev # using Makefile to create development envionment
pre-commit install && pre-commit install --hook-type commit-msg -f
python manage.py runserver # Run Django locally
celery -A taskflow_api worker --loglevel=info # Start CeleryLocal URLs:
pytestpytest --cov=. --cov-report=term-missingpytest --cov=. --cov-report=html
# Open htmlcov/index.html in your browserWhen a task is created via API, a background task (log_task_action) is triggered:
- Logs to
logs/task_activity.log - Format:
[2025-09-14 19:45:00] Task #12 ('Example Task') was created via Celery background task.
./run_server.shThis command will:
- Build the Docker image
- Run Django with Gunicorn
- Serve via Nginx on port
80 - Collect static files into a volume
- Expose the full app on http://localhost/
Alternatively:
docker compose up --build- Web App: http://localhost/
- API: http://localhost/api/tasks/
- Swagger Docs: http://localhost/docs/
- RabbitMQ UI: http://localhost:15672 (user/pass: guest/guest)
| Layer | Tech |
|---|---|
| Backend | Django 5 + DRF |
| Database | PostgreSQL |
| Broker | RabbitMQ |
| Async Tasks | Celery |
| Server | Gunicorn + Nginx |
| Containers | Docker Compose |
| Testing | Pytest + pytest-cov |
| Linting | Ruff |
| Deployment | Shell scripts + volumes |
MIT Β© Omid Hashemzadeh