Skip to content

πŸš€ Django-CFG: Type-Safe Django Configuration Framework with AI-Ready Infrastructure

License

Notifications You must be signed in to change notification settings

markolofsen/django-cfg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

274 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Django-CFG Logo

Django-CFG

PyPI Python Django License Downloads

The Modern Django Framework for Enterprise Applications

Type-safe configuration β€’ Streamlit Admin β€’ Real-time WebSockets β€’ gRPC Streaming β€’ AI-Native Docs β€’ 8 Production Apps

Get Started β€’ Live Demo β€’ Documentation β€’ MCP Server


What is Django-CFG?

Django-CFG is a next-generation Django framework that replaces settings.py with type-safe Pydantic v2 models. Catch configuration errors at startup, get full IDE autocomplete, and ship production-ready features in 30 seconds instead of weeks.

Why Django-CFG?

  • βœ… Type-safe config - Pydantic v2 validation catches errors before deployment
  • βœ… 90% less code - Replace 200+ line settings.py with 30 lines
  • βœ… Streamlit Admin - Python-only admin panel, auto-starts with Django
  • βœ… Real-time WebSockets - Centrifugo integration included
  • βœ… gRPC streaming - Bidirectional streaming with WebSocket bridge
  • βœ… AI-native docs - First Django framework with MCP server for AI assistants
  • βœ… 8 enterprise apps - Save 18+ months of development

Quick Start

One-Line Install

# macOS / Linux
curl -L https://djangocfg.com/install.sh | sh

# Windows (PowerShell)
powershell -c "iwr https://djangocfg.com/install.ps1 | iex"

Manual Install

pip install 'django-cfg[full]'
django-cfg create-project my_app
cd my_app/projects/django
poetry run python manage.py runserver

What you get instantly:

  • 🎨 Django Admin β†’ http://127.0.0.1:8000/admin/
  • πŸ“Š Streamlit Dashboard β†’ Auto-starts on port 8501
  • πŸ“‘ Real-time WebSockets β†’ Live updates
  • 🐳 Docker Ready β†’ Production configs
  • πŸ–₯️ Electron App β†’ Desktop template

β†’ Full Installation Guide


Configuration Example

Before: settings.py

# 200+ lines of untyped configuration
DEBUG = os.getenv('DEBUG', 'False') == 'True'  # ❌ Bug waiting to happen
DATABASE_PORT = os.getenv('DB_PORT', '5432')   # ❌ Still a string!

After: Django-CFG

from django_cfg import DjangoConfig, DatabaseConfig

class MyConfig(DjangoConfig):
    project_name: str = "My App"
    debug: bool = False  # βœ… Type-safe

    databases: dict[str, DatabaseConfig] = {
        "default": DatabaseConfig(
            name="${DB_NAME}",  # βœ… Validated at startup
            port=5432,          # βœ… Correct type
        )
    }

Full IDE autocomplete β€’ Startup validation β€’ Zero runtime errors


Features

πŸ”’ Type-Safe Configuration

Pydantic v2 models replace error-prone settings.py - catch bugs before deployment.

πŸ“Š Streamlit Admin

Python-only admin panel that auto-starts with Django. No npm, no Node.js - just Python.

from django_cfg import DjangoConfig
from django_cfg.modules.streamlit_admin import StreamlitAdminConfig

config = DjangoConfig(
    streamlit_admin=StreamlitAdminConfig(
        app_path="streamlit",
        auto_start=True,  # Starts with Django, dies with Django
    ),
)

πŸ“‘ Real-Time WebSockets

Production-ready Centrifugo integration - live updates, notifications, presence tracking.

🌐 gRPC Microservices

Bidirectional streaming with automatic WebSocket bridge - perfect for real-time architectures.

πŸ€– AI-Native Documentation

First Django framework with MCP server - AI assistants can access docs instantly.

πŸ“¦ 8 Enterprise Apps

User auth β€’ Support tickets β€’ Newsletter β€’ CRM β€’ AI agents β€’ Knowledge base β€’ Payments β€’ Multi-site

Time saved: 18+ months of development

β†’ See All Features


What's Included

Backend:

  • Django 5.2+ with type-safe config
  • PostgreSQL, Redis, Centrifugo
  • gRPC server with streaming
  • 8 production-ready apps
  • AI agent framework
  • REST API with auto TypeScript generation

Admin:

  • Streamlit admin (Python-only)
  • Django Unfold for CRUD
  • JWT authentication
  • Dark theme by default

DevOps:

  • Docker Compose setup
  • Traefik reverse proxy
  • Production-ready configs
  • Cloudflare integration

AI Features:

  • MCP server for AI assistants
  • Pydantic AI integration
  • Vector DB (ChromaDB)
  • RAG support

Documentation


Community


License

MIT License - Free for commercial use


Django-CFG - Modern Django framework with type-safe configuration, AI-native docs, Streamlit admin, gRPC streaming, real-time WebSockets, and 8 production-ready apps.

Made with ❀️ for the Django community

Get Started β€’ Live Demo β€’ GitHub

About

πŸš€ Django-CFG: Type-Safe Django Configuration Framework with AI-Ready Infrastructure

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •