Integrations Overview
Django-CFG provides seamless integrations with essential third-party services and tools, making it easy to add powerful features to your Django application with minimal configuration.
Available Integrations
🔄 Background Tasks
Django-RQ Integration
Production-ready Redis-based task queue with built-in monitoring:
Core Features:
- ✅ High performance - 10,000+ jobs/second with low memory usage
- ✅ Redis-backed queue with automatic job persistence
- ✅ Type-safe configuration with Pydantic validation
- ✅ Worker management via CLI commands (rqworker, rqcron)
- ✅ Cron scheduling on RQ’s native cron (
rqcron) for periodic tasks - ✅ Built-in monitoring - Django Admin, REST API, Prometheus metrics
- ✅ Job dependencies and retry logic with exponential backoff
Use Cases:
- Email sending and notifications (Email Module)
- Document processing
- Bulk operations (Newsletter campaigns, data imports)
- Scheduled tasks (cleanup jobs, report generation)
🔐 Authentication
Authentication Patterns
Enterprise authentication integration:
Core Features:
- ✅ JWT authentication with djangorestframework-simplejwt
- ✅ Two-Factor Authentication (2FA) with TOTP (RFC 6238) for authenticator apps
- ✅ Google and GitHub sign-in built in (client id + secret, PKCE, one verified email = one user)
- ✅ OTP Login passwordless email-based login
- ✅ Backup codes for 2FA recovery
- ✅ API key authentication for machine-to-machine
Use Cases:
- REST API authentication with JWT tokens
- Two-factor authentication for high-security apps
- Passwordless login with email OTP
- Social sign-in with Google and GitHub
📐 Best Practices
Integration Patterns
Common patterns and best practices:
Core Patterns:
- ✅ Webhook handling patterns and security
- ✅ API client configuration and error handling
- ✅ Rate limiting and retry strategies
- ✅ Secret management with environment variables
- ✅ Testing strategies for third-party integrations
Use Cases:
- Building robust webhook handlers
- Implementing API rate limiting
- Managing third-party secrets
- Testing external integrations
CMDOP
Connect supported AI clients to an authorized development machine and work on your Django-CFG repository through MCP or the SDK. This is a separate machine integration, not the application-level django_mcp module.
Quick Start
Enable Django-RQ for Background Tasks
# api/config.py
from django_cfg import DjangoConfig
from django_cfg.models import DjangoRQConfig, RQQueueConfig
class MyConfig(DjangoConfig):
redis_url: str = "redis://localhost:6379/0"
django_rq: DjangoRQConfig = DjangoRQConfig(
enabled=True,
redis_db=0, # Required: unique per project (0-15)
queues=[
RQQueueConfig(queue="default"),
],
)# apps/myapp/tasks.py
def send_welcome_email(user_id: int):
"""Task runs in background worker."""
# Task code here
pass
# Enqueue from anywhere
import django_rq
queue = django_rq.get_queue('default')
queue.enqueue('apps.myapp.tasks.send_welcome_email', user_id=123)Integration Architecture
Type-Safe Configuration
All integrations use Pydantic v2 for validation:
from django_cfg import DjangoConfig
from django_cfg.models import DjangoRQConfig, RQQueueConfig
class MyConfig(DjangoConfig):
redis_url: str = "redis://localhost:6379/0"
# Django-RQ configuration
django_rq: DjangoRQConfig = DjangoRQConfig(
enabled=True,
redis_db=0, # Required: unique per project (0-15)
queues=[
RQQueueConfig(queue="default"),
RQQueueConfig(queue="high"),
],
)Environment-Based Enablement
Enable integrations per environment using environment detection:
class MyConfig(DjangoConfig):
@property
def django_rq(self) -> DjangoRQConfig | None:
# Only run background workers outside of development
if self.is_development:
return None
return DjangoRQConfig(enabled=True, redis_db=0)Automatic Django Integration
Integrations automatically configure Django settings:
- Django-RQ: Configures RQ_QUEUES, Redis connections, worker management
- Auth: Configures authentication backends, middleware, JWT settings
Integration Comparison
| Integration | Type | Production Ready | Auto-Config | CLI Tools |
|---|---|---|---|---|
| Django-RQ | Task Queue | ✅ Yes | ✅ Yes | ✅ rqworker, rqcron, rqstats |
| JWT Auth | Security | ✅ Yes | ✅ Yes | - |
| 2FA/TOTP | Security | ✅ Yes | ✅ Yes | - |
| OTP Login | Security | ✅ Yes | ✅ Yes | - |
Configuration Best Practices
1. Use Environment Variables for Secrets
# config.prod.yaml
telegram:
bot_token: "${TELEGRAM_BOT_TOKEN}" # From environment
2. Enable Only What Each Environment Needs
class ProductionConfig(DjangoConfig):
# Django-RQ for production background tasks
django_rq: DjangoRQConfig = DjangoRQConfig(
enabled=True,
redis_db=0, # Required: unique per project (0-15)
queues=[
RQQueueConfig(queue="high"),
RQQueueConfig(queue="default"),
RQQueueConfig(queue="low"),
],
)3. Test Integrations Before Production
# Test Django-RQ workers
python manage.py rqworker default
# Check queue stats
python manage.py rqstatsSee Also
Core Integrations
Background Processing:
- Django-RQ Overview - Complete task queue guide
- Django-RQ Architecture - System design and components
- Django-RQ Configuration - Setup and configuration
- Django-RQ Examples - Real-world task patterns
- Django-RQ Monitoring - Task monitoring and observability
Authentication:
- Auth Patterns - Enterprise authentication
- User Management - Built-in user system
Communication:
- Telegram Module - Bot notifications
- Email Module - Email sending
Configuration & Setup
Getting Started:
- Configuration Guide - Enable integrations
- Configuration Models - Integration config API
- Environment Detection - Environment-specific integrations
Infrastructure:
- Redis Configuration - Redis setup for Django-RQ
- Security Settings - Webhook signature verification
- Environment Variables - Manage API keys securely
Related Features
Other Modules:
- Modules Overview - All available modules
- LLM Module - AI model integration
Tools & Guides
CLI Commands:
- CLI Introduction - All CLI tools
Guides:
- Integration Patterns - Best practices
- Production Config - Production integration setup
- Troubleshooting - Common integration issues
Next Steps
New to Integrations?
- Start with Django-RQ Overview for background tasks
- Review Integration Patterns for best practices
Ready for Production?
- Review Production Config
- Set up Redis for Django-RQ
- Configure environment variables for secrets
- Deploy workers using Django-RQ Monitoring guide
Need Help?
Django-CFG integrations: Production-ready, type-safe, zero-config. 🚀