Django-CFG Examples
Comprehensive real-world examples demonstrating Django-CFG capabilities across different features and industries.
Quick Start Examples
Start here if you’re new to Django-CFG:
Sample Project Guide
Complete walkthrough of a production-ready Django-CFG project with all features:
- Multi-database setup
- Modern admin interface
- API documentation
- Background tasks
- Service integrations
Perfect for: Beginners wanting to see everything in action
Currency Conversion Examples
Examples showing multi-currency support across different industries.
E-commerce Applications
- Multi-currency product catalogs
- Shopping cart with currency conversion
- Dynamic pricing
Financial Applications
- Crypto portfolio tracking
- Investment returns calculator
- Multi-asset tracking
Import/Export Business
- Vehicle import cost calculator
- Global pricing strategies
- International shipping costs
Gaming & Entertainment
- In-game currency exchange
- Regional pricing for game items
- Optimal purchase calculator
Business Intelligence
- Multi-currency revenue analytics
- Cross-border sales analysis
- Currency exposure reporting
Supports: 14K+ currencies including fiat, crypto, stocks, commodities
Background Tasks Examples
Background task processing with Django-RQ.
Django-RQ Examples
- Email campaign processing
- Document processing pipelines
- Data synchronization
- Report generation
- Scheduled cleanup tasks
Perfect for: Asynchronous workflows, heavy computations, scheduled jobs
Payments Integration Examples
Real-world payment integration examples with webhook handling.
- Stripe integration
- Crypto payment providers
- Webhook handling
- Payment status tracking
Includes: Webhook dashboard, payment status tracking
Communication Examples
Multi-channel communication examples (Email, Telegram).
Email Examples
from django_cfg.modules.django_email import DjangoEmailService
email = DjangoEmailService()
email.send_simple(
subject="Welcome to Django-CFG",
message="Thank you for signing up!",
recipient_list=["[email protected]"],
)Telegram Examples
from django_cfg import send_telegram_message
send_telegram_message(
"Your order has been shipped!",
chat_id="123456",
)Use cases: Notifications, OTP authentication, customer support
Multi-Database Examples
Examples showing smart database routing and multi-database architecture.
Basic Multi-Database Setup
from django_cfg import DjangoConfig, DatabaseConfig
class MyConfig(DjangoConfig):
databases: dict[str, DatabaseConfig] = {
"default": DatabaseConfig(
engine="postgresql",
name="main_db",
),
"analytics": DatabaseConfig(
name="analytics_db",
apps=["analytics", "reports"], # Auto-routes!
),
}Usage in Code
# No manual .using() calls needed!
report = Report.objects.create(...) # Automatically goes to analytics_db
user = User.objects.create(...) # Goes to default databaseSee: Sample Project Multi-Database Guide
Admin Interface Examples
Examples of customizing the admin (the stock Django admin with the django-cfg theme): see Admin Site.
Dashboard Integration
The Overview is at /admin/. Its tabs are server-rendered pages at /cfg/admin/dashboard/<slug>/, declared with DashboardConfig and DashboardTab.
See: Sample Project Admin Interface
API Documentation Examples
Auto-generated OpenAPI documentation with TypeScript and Python clients.
Multi-Group API Setup
from django_cfg import OpenAPIClientConfig, OpenAPIGroupConfig
class MyConfig(DjangoConfig):
openapi_client: OpenAPIClientConfig = OpenAPIClientConfig(
enabled=True,
api_prefix="api",
output_dir="openapi",
drf_title="My App API",
drf_description="Complete API documentation",
drf_version="1.0.0",
groups=[
OpenAPIGroupConfig(
name="public",
apps=["blog", "products"],
title="Public API",
description="Public-facing API endpoints",
version="1.0.0",
),
OpenAPIGroupConfig(
name="partner",
apps=["integrations"],
title="Partner API",
description="Partner integration endpoints",
version="1.0.0",
),
],
)Automatically provides:
- TypeScript clients with Orval operations, React Query v5 hooks/query keys, and Zod validation schemas
- Python clients with type hints
- MSW handlers for tests and local development
- Stable runtime/barrel exports for transport, auth, and generated models
See: Sample Project API Documentation
Built-in Apps Examples
Production-ready built-in applications.
User Management with OTP
The accounts app (django_cfg.apps.system.accounts) is always installed; there is no flag to enable it. It provides:
- Email OTP authentication
- User profiles
- Activity tracking
- 2FA (TOTP)
See: Built-in Apps Documentation
Authentication Examples
Multi-channel OTP authentication examples.
Email OTP
from django_cfg.apps.system.accounts.services.otp_service import OTPService
# Request OTP: returns OTPRequestResult(success, error_code, retry_after, ...)
result = OTPService.request_otp("[email protected]")
# Verify OTP: returns the user, or None on any failure
user = OTPService.verify_otp("[email protected]", "123456")See: Sample Project Authentication
More Examples
By Feature
- First Project Guide - Step-by-step project setup
- Production Examples - Production-ready configurations
- Migration Examples - Migrating existing Django projects
By Industry
- E-commerce - Product catalogs, shopping carts, payments
- Finance - Portfolio tracking, investment calculators
- SaaS - Multi-tenant, subscriptions, billing
- Enterprise - Support tickets, user management, analytics
Choose Your Path
New to Django-CFG? → Start with Sample Project Guide
Setting up Background Tasks? → Explore Django-RQ Examples
Contributing Examples
Have a great Django-CFG example? We’d love to include it!
- Fork the documentation repository
- Add your example with clear code comments
- Submit a pull request