Skip to Content
CLICommand ReferenceOverview

CLI Commands Overview

Django-CFG provides 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

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 [email protected] # Check settings and diagnostics python manage.py check_settings

View Quick Reference →

🧪 Testing

Testing & Monitoring

# Endpoint health checker (production-ready) python manage.py check_endpoints --json # Test email cli test-email --to [email protected] # Test Telegram cli test-telegram --message "Hello!"

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/

View Testing & Monitoring →

🛠️ Development

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

View Development Tools →

🚀 Production

Production Operations

# Check settings and diagnostics python manage.py check_settings --verbose # Migrate all databases python manage.py migrate_all # Check endpoint health python manage.py check_endpoints

View Core Commands →


📋 All Command Categories

🔧 Core Commands — 7 commands

Project setup, configuration validation, and system checks.

CommandDescription
django-cfg create-projectCreate new Django project with full setup
django-cfg infoShow installation and system information
show_configDisplay current configuration
check_settingsComprehensive diagnostics
show_urlsList all URL patterns
migrate_allMigrate all databases
superuserCreate superuser

Full Documentation →

🧪 Testing & Monitoring — 4 commands

Health checks, endpoint validation, and service testing.

CommandDescription
check_endpointsProduction-ready endpoint health checker
test_emailTest email configuration
test_telegramTest Telegram bot
otp_testTest OTP authentication

REST API Available Access endpoint health via REST API:

curl http://localhost:8000/cfg/endpoints/

Full Documentation →

🛠️ Development Tools — 8 commands

Development server and productivity tools.

CommandDescription
cli runserverEnhanced development server
runserver_ngrokRun with ngrok tunnel
scriptRun scripts with Django context
treeShow project structure
list_urlsList all URL patterns
generateGenerate Django components
create_tokenCreate API tokens
clear_constanceClear Constance cache

Full Documentation →

📡 Centrifugo / WebSocket — 3 commands

Real-time messaging and WebSocket RPC client generation.

CommandDescription
centrifugo_publishPublish messages to Centrifugo channels for testing
generate_centrifugo_clientsGenerate type-safe WebSocket RPC clients (Python, TypeScript, Go, Swift)
create_centrifugo_d1_schemaCreate Cloudflare D1 schema for Centrifugo logs

Full Documentation →

🔄 Background Tasks — Django-RQ — 9 commands

Django-RQ worker management, scheduling, and monitoring.

CommandDescription
rearq main:rearq workerStart background workers
rearq main:rearq timerStart cron task scheduler
rearq main:rearq serverStart monitoring server
test_tasksTest task processing
rqworkerStart RQ worker process
rqworker_poolStart RQ worker pool (multiple workers)
rqschedulerStart RQ scheduler for cron/interval tasks
rqstatsShow RQ queue statistics
rq_cleanup_locksClean stale RQ job locks

Full Documentation →

🌐 gRPC / Communication — 4 commands

gRPC server, protocol buffer compilation, and schema generation.

CommandDescription
rungrpcStart async gRPC server
compile_protoCompile .proto files to Python stubs
generate_protosGenerate .proto definitions from Django models
create_grpc_d1_schemaCreate Cloudflare D1 schema tables for gRPC

☁️ Cloudflare D1 — 5 commands

Cloudflare D1 database integration, sync, and logging.

CommandDescription
cf_statusShow Cloudflare D1 connection status
cf_sync_usersSync Django users to D1
d1_logsView D1 operation logs
create_rq_d1_schemaCreate D1 schema for RQ events
create_centrifugo_d1_schemaCreate D1 schema for Centrifugo logs

🖥️ Streamlit Admin — 3 commands

Streamlit-based admin panel scaffolding and management.

CommandDescription
create_streamlit_appScaffold a new Streamlit admin app
run_streamlitStart Streamlit admin server
gen_streamlitGenerate Streamlit pages from Django models

⚙️ Code Generation — 2 commands

Generate code from Django models for other frameworks.

CommandDescription
generate_fastapiGenerate FastAPI/SQLModel code from Django models
generate_clientGenerate standalone API client

📊 LLM & Monitoring — 2 commands

LLM balance checks and monitoring cleanup.

CommandDescription
check_llm_balanceCheck OpenAI/OpenRouter API balance
monitor_cleanupClean old monitor events

🤖 Telegram — 1 command

Telegram bot management.

CommandDescription
telegram_botStart Telegram bot in polling mode

🔑 Auth / OTP — 1 command

Authentication and OTP utilities.

CommandDescription
otp_reset_throttleReset OTP throttle for a user

🌍 Geo — 1 command

Geographic and timezone data management.

CommandDescription
geo_populatePopulate geo/timezone data

🎯 Common Workflows

Initial Project Setup

# 1. Create project django-cfg create-project "My Project" cd my_project # 2. Check settings python manage.py check_settings --verbose # 3. Migrate databases python manage.py migrate_all # 4. Create superuser cli superuser --email [email protected] # 5. Check endpoint health python manage.py check_endpoints # 6. Run server cli runserver

Pre-Deployment Checklist

# 1. Check settings python manage.py check_settings --verbose # 2. Check endpoint health python manage.py check_endpoints # 3. Test integrations cli test-email --to [email protected] # 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

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

Validation

Always Validate

# Before deployment python manage.py check_settings --verbose # Before migrations python manage.py migrate_all --dry-run

Testing

Test After Changes

# Test email cli test-email --to [email protected] # Test messaging cli test-telegram --message "Deploy successful" # Test endpoints python manage.py check_endpoints

Monitoring

Continuous Monitoring

# Endpoint health check curl http://localhost:8000/cfg/endpoints/ | jq # Check all endpoints python manage.py check_endpoints --json

🔗 Quick Navigation

I want to…Go to…
Find a command quicklyQuick Reference
Set up a new projectCore Commands
Monitor API healthTesting & Monitoring
Start developmentDevelopment Tools
Run gRPC servergRPC / Communication (above)
Manage background tasksBackground Tasks (above)
Use Cloudflare D1Cloudflare D1 (above)
Generate codeCode Generation (above)

Next Steps

One powerful CLI.

Last updated on