CLI Commands Overview
Django-CFG provides 40+ management commands for development, testing, monitoring, and production operations.
Quick Start
New to Django-CFG? Start with the Quick Reference for most common commands!
๐ Command Categoriesโ
- ๐ Essential
- ๐งช Testing
- ๐ ๏ธ Development
- ๐ Production
Most Used Commandsโ
# Check all API endpoints health
python manage.py check_endpoints
# Migrate all databases
python manage.py migrate_all
# Run development server
cli runserver
# Create superuser
cli superuser --email admin@example.com
# Show configuration
python manage.py show_config
Testing & Monitoringโ
# Endpoint health checker (production-ready)
python manage.py check_endpoints --json
# Test email
cli test-email --to admin@test.com
# Test Telegram
cli test-telegram --message "Hello!"
# Test SMS/WhatsApp
python manage.py test_twilio --to "+1234567890"
# Test payment providers
python manage.py test_providers
Feature Highlight
check_endpoints includes:
- Auto-resolves parametrized URLs (
<int:pk>,<uuid:id>) - JWT auto-authentication
- Multi-database awareness
- REST API for monitoring at
/cfg/endpoints/
Development Toolsโ
# Enhanced development server
cli runserver --port 3000
# Run with ngrok tunnel
python manage.py runserver_ngrok
# List all URLs
python manage.py list_urls --pattern "api/"
# Show project structure
python manage.py tree --depth 3
# Run custom script
python manage.py script my_script.py
Production Operationsโ
# Validate configuration
python manage.py validate_config --check-connections
# Migrate all databases
python manage.py migrate_all
# Process pending payments (cron job)
python manage.py process_pending_payments
# Maintenance mode
python manage.py maintenance enable --cloudflare
# Cleanup expired data
python manage.py cleanup_expired_data --days 30
๐ All Command Categoriesโ
๐ง Core Commands โ 8 commandsโ
Project setup, configuration validation, and system checks.
| Command | Description |
|---|---|
django-cfg create-project | Create new Django project with full setup |
django-cfg info | Show installation and system information |
show_config | Display current configuration |
validate_config | Validate settings and connections |
check_settings | Comprehensive diagnostics |
show_urls | List all URL patterns |
migrate_all | Migrate all databases |
superuser | Create superuser |
๐งช Testing & Monitoring โ 6 commandsโ
Health checks, endpoint validation, and service testing.
| Command | Description |
|---|---|
check_endpoints | Production-ready endpoint health checker |
test_email | Test email configuration |
test_telegram | Test Telegram bot |
test_twilio | Test SMS/WhatsApp |
test_providers | Test payment providers |
test_otp | Test OTP authentication |
REST API Available
Access endpoint health via REST API:
curl http://localhost:8000/cfg/endpoints/
๐ ๏ธ Development Tools โ 8 commandsโ
Development server and productivity tools.
| Command | Description |
|---|---|
cli runserver | Enhanced development server |
runserver_ngrok | Run with ngrok tunnel |
script | Run scripts with Django context |
tree | Show project structure |
list_urls | List all URL patterns |
generate | Generate Django components |
create_token | Create API tokens |
clear_constance | Clear Constance cache |
๐ค AI Agents โ 2 commandsโ
AI agent management and orchestration.
| Command | Description |
|---|---|
create_agent | Create agents from templates |
orchestrator_status | Show orchestrator statistics |
๐ Knowledge Base โ 2 commandsโ
Vector search and knowledge management.
| Command | Description |
|---|---|
setup_knowbase | Setup pgvector extension |
knowbase_stats | Show knowledge base statistics |
๐ Background Tasks โ Django-RQ Integrationโ
Django-RQ worker management via native CLI.
| Command | Description |
|---|---|
rearq main:rearq worker | Start background workers |
rearq main:rearq timer | Start cron task scheduler |
rearq main:rearq server | Start monitoring server |
test_tasks | Test task processing |
๐ง Maintenance Mode โ 3 commandsโ
Maintenance mode and Cloudflare integration.
| Command | Description |
|---|---|
maintenance | Enable/disable maintenance mode |
sync_cloudflare | Sync with Cloudflare |
process_scheduled_maintenance | Process scheduled windows |
๐ณ Payments โ 6 commandsโ
Payment system management.
| Command | Description |
|---|---|
currency_stats | Currency statistics |
manage_currencies | Manage currencies |
manage_providers | Manage payment providers |
test_providers | Test provider integrations |
process_pending_payments | Process pending payments |
cleanup_expired_data | Cleanup old payment data |
๐ฏ Common Workflowsโ
Initial Project Setupโ
# 1. Create project
django-cfg create-project "My Project"
cd my_project
# 2. Validate configuration
python manage.py validate_config --check-connections
# 3. Migrate databases
python manage.py migrate_all
# 4. Create superuser
cli superuser --email admin@example.com
# 5. Check endpoint health
python manage.py check_endpoints
# 6. Run server
cli runserver
Pre-Deployment Checklistโ
# 1. Validate configuration
python manage.py validate_config --check-connections
# 2. Check endpoint health
python manage.py check_endpoints
# 3. Test integrations
cli test-email --to admin@example.com
python manage.py test_providers
# 4. Run migrations
python manage.py migrate_all
# 5. Collect static files
python manage.py collectstatic --noinput
CI/CD Integrationโ
# Health check in pipeline
python manage.py check_endpoints --json | jq '.errors'
# Exit if unhealthy
test $(python manage.py check_endpoints --json | jq '.errors') -eq 0
Production Tip
Add endpoint health checks to your monitoring:
# Cron job - every 5 minutes
*/5 * * * * python manage.py check_endpoints --json > /var/log/health.json
๐ก Best Practicesโ
- Isolation
- Validation
- Testing
- Monitoring
Use Poetry for Isolationโ
# Recommended
poetry run cli runserver
poetry run python manage.py check_endpoints
# Also works but less isolated
python manage.py runserver
Always Validateโ
# Before deployment
poetry run cli validate-config --check-connections
# Before migrations
python manage.py migrate_all --dry-run
# Before cleanup
python manage.py cleanup_expired_data --dry-run
Test After Changesโ
# Test email
cli test-email --to admin@test.com
# Test messaging
cli test-telegram --message "Deploy successful"
# Test payments
python manage.py test_providers
# Test endpoints
python manage.py check_endpoints
Continuous Monitoringโ
# Endpoint health check
curl http://localhost:8000/cfg/endpoints/ | jq
# System stats
python manage.py orchestrator_status --detailed
# Currency stats
python manage.py currency_stats --format json
๐ Quick Navigationโ
| I want to... | Go to... |
|---|---|
| Find a command quickly | Quick Reference |
| Set up a new project | Core Commands |
| Monitor API health | Testing & Monitoring |
| Start development | Development Tools |
| Manage payments | Payments |
| Use AI agents | AI Agents |
| Configure maintenance | Maintenance |
Next Steps
- ๐ New to Django-CFG? Start with Quick Reference
- ๐งช Need monitoring? See Testing & Monitoring
- ๐ Ready to deploy? Check Core Commands
40+ commands. One powerful CLI. ๐