Example project applying the patterns from Cosmic Python by Harry Percival and Bob Gregory. This project demonstrates how to build maintainable, testable Django applications using Domain-Driven Design principles while leveraging Django's strengths.
📖 Read the full post: Cosmic Django
- Domain modeling plus helper functions
- No Repository Pattern
- Service Layer Pattern
- Atomic transactions
- Design by contract
- Event-driven architecture with signals
- Command-query responsibility segregation
- Python 3.11+
- uv package manager
# Clone the repository
git clone https://github.com/brunodantas/cosmic-django.git
cd cosmic-django
# Install dependencies
make install dev-install
# Set up the database (sqlite)
make migrate
# Run tests to verify installation
make test
# Start development server
make runserverThe project includes a Makefile for development tasks.
Generate and view the project's dependency graph.
Needs to uncomment the imports from this init file beforehand.
# Generate dependency graph
pydeps cosmic/__init__.py- Cosmic Python Book - The inspiration for this project
- Django Documentation - Official Django guide
- Domain-Driven Design - Martin Fowler's DDD resources
This project is licensed under the GPL License - see the LICENSE file for details.