How ppsite/cc_django works
Project Type and Purpose
• This is a backend‐focused Django project template (Cookiecutter) that scaffolds a monolithic web application.
• It provides best practices for multi‐environment settings, custom user model, optional REST API (DRF), admin UI override (Grappelli), background tasks (Celery), and object storage (Boto3/MinIO).
High-Level Components
a. Entry Points
• manage.py – Django CLI for migrations, server, etc.
• asgi.py / wsgi.py – ASGI/Web Server Gateway.
b. Core Django Stack
• Django Project Package – settings.py, urls.py, celery.py.
• Apps:
– account: custom user and authentication
– media: ExternalImage management + serialization
– tag: ColoredTag/KeyValueTag management
– utils: shared helpers (DRF mixins, pagination, caching, etc.).
c. Optional Plugins
• DRF for REST endpoints (config/plugins/drf.py)
• Grappelli for admin UI (config/plugins/grappelli.py)
• Celery for async tasks (celery.py, config/plugins/storage.py)
• Boto3 for S3 storage (config/plugins/storage.py)
d. Configuration & Environments
• config/ – base.py, develop.py, product.py, settings.py
• .envrc / env loading (utils/env.py)
• uwsgi.ini for production UWSGI server
e. External Services
• Relational database (Postgres/MySQL) via Django ORM
• Message broker (Redis/RabbitMQ) for Celery
• S3‐compatible storage (AWS or MinIO) via Boto3
Interactions and Data Flows
1. Client (browser/mobile/HTTP tool) → Django →
• Views (DRF ViewSets or Django views) → ORM → Database
• Views → Serializers → JSON responses
2. Admin user → Grappelli-enhanced Django Admin → ORM → Database
3. Django app → Celery tasks → Message broker → Celery worker → Database / S3
4. Media uploads → Django storage backend (Boto3) → S3 bucket → Stored files
Architectural Patterns & Design Principles
• Monolithic Django with clear “apps” as modules.
• Twelve-factor style: config via environment variables.
• Pluggable features loaded via settings/plugins.
• Separation of concerns:
• URL routing (project urls.py & app urls.py)
• Business logic in views/ serializers/ models
• Shared utilities in utils/
• Async tasks isolated via Celery.