Skip to main content

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

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, rqscheduler)
  • Cron scheduling with RQ Scheduler 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)
  • Payment processing (Payment System)
  • Document processing (AI Knowledge Base)
  • Bulk operations (Newsletter campaigns, data imports)
  • Scheduled tasks (cleanup jobs, report generation)

Full Django-RQ Guide →


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,
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)

Full Django-RQ Guide →

Enable Ngrok for Webhook Testing

# config.dev.yaml
ngrok:
enabled: true
subdomain: "myapp" # myapp.ngrok.io
auth_token: "${NGROK_AUTH_TOKEN}"
# Start server with ngrok tunnel
python manage.py runserver_ngrok

Full Ngrok Guide →


Integration Architecture

Type-Safe Configuration

All integrations use Pydantic v2 for validation:

from django_cfg import DjangoConfig
from django_cfg.models import DjangoRQConfig, RQQueueConfig, NgrokConfig

class MyConfig(DjangoConfig):
redis_url: str = "redis://localhost:6379/0"

# Django-RQ configuration
django_rq: DjangoRQConfig = DjangoRQConfig(
enabled=True,
queues=[
RQQueueConfig(queue="default"),
RQQueueConfig(queue="high"),
],
)

# Ngrok configuration
ngrok: NgrokConfig | None = NgrokConfig(
enabled=True,
subdomain="myapp"
)

Environment-Based Enablement

Enable integrations per environment using environment detection:

class MyConfig(DjangoConfig):
@property
def ngrok(self) -> NgrokConfig | None:
# Only enable ngrok in development
if self.is_development:
return NgrokConfig(enabled=True)
return None

Automatic Django Integration

Integrations automatically configure Django settings:

  • Django-RQ: Configures RQ_QUEUES, Redis connections, worker management
  • Ngrok: Updates ALLOWED_HOSTS, CSRF_TRUSTED_ORIGINS, generates public URL
  • Auth: Configures authentication backends, middleware, JWT settings

Integration Comparison

IntegrationTypeProduction ReadyAuto-ConfigCLI Tools
Django-RQTask Queue✅ Yes✅ Yesrqworker, rqscheduler, rqstats
NgrokDevelopment Tool⚠️ Dev Only✅ Yesrunserver_ngrok
AuthSecurity✅ Yes✅ Yestest_auth
TwilioCommunication✅ Yes✅ Yestest_sms

Configuration Best Practices

1. Use Environment Variables for Secrets

# config.prod.yaml
ngrok:
auth_token: "${NGROK_AUTH_TOKEN}" # From environment

twilio:
account_sid: "${TWILIO_ACCOUNT_SID}"
auth_token: "${TWILIO_AUTH_TOKEN}"

2. Disable in Production When Not Needed

class ProductionConfig(DjangoConfig):
# Ngrok only for development
ngrok: None = None

# Django-RQ for production background tasks
django_rq: DjangoRQConfig = DjangoRQConfig(
enabled=True,
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 rqstats

# Test Twilio SMS
python manage.py test_sms +1234567890

# Test ngrok tunnel (dev only)
python manage.py runserver_ngrok --test

See Also

Core Integrations

Background Processing:

Development Tools:

Authentication:

Communication:

Configuration & Setup

Getting Started:

Infrastructure:

Apps Using Integrations:

Other Modules:

Tools & Guides

CLI Commands:

Guides:


Next Steps

New to Integrations?

  1. Start with Django-RQ Overview for background tasks
  2. Try Ngrok Overview for webhook testing
  3. Review Integration Patterns for best practices

Ready for Production?

  1. Review Production Config
  2. Set up Redis for Django-RQ
  3. Configure environment variables for secrets
  4. Deploy workers using Django-RQ Monitoring guide

Need Help?


Django-CFG integrations: Production-ready, type-safe, zero-config. 🚀