CLI Commands Quick Reference
Fast reference guide for all Django-CFG management commands. Perfect for quick lookups!
Quick Overview
| Task | Command | Description |
|---|---|---|
| Create project | django-cfg create-project my_project | Initialize new Django-CFG project |
| Migrate databases | python manage.py migrate_all | Run migrations on all databases |
| Run server | cli runserver | Start enhanced development server |
| Create superuser | cli superuser --email [email protected] | Create admin user |
| Check settings | python manage.py check_settings | Comprehensive diagnostics |
| Check endpoints | python manage.py check_endpoints | Test all API endpoints |
| Show URLs | cli show-urls | List all registered URLs |
| Test email | cli test-email --to [email protected] | Send test email |
| Start worker | rearq main:rearq worker | Start background task worker |
| Start gRPC server | python manage.py rungrpc | Start async gRPC server |
| D1 status | python manage.py cf_status | Check Cloudflare D1 connection |
| Streamlit admin | python manage.py run_streamlit | Start Streamlit admin server |
| RQ stats | python manage.py rqstats | Show queue statistics |
| LLM balance | python manage.py check_llm_balance | Check API credit balance |
🚀 Project Setup
# Create new project
django-cfg create-project my_project
# Show Django-CFG info
django-cfg info --verbose
# Check settings
python manage.py check_settings --verbose
# Show current configuration
python manage.py show_config --format yaml🗄️ Database Operations
# Migrate all databases (recommended)
python manage.py migrate_all
# Smart migration with auto-detection
python manage.py migrator --auto
# Dry run to preview migrations
python manage.py migrate_all --dry-run
# Migrate specific database
python manage.py migrator --database analytics_db🏃 Development Server
# Enhanced development server
cli runserver
# With ngrok tunnel (for webhooks)
python manage.py runserver_ngrok
# Custom port and host
cli runserver --port 3000 --host 0.0.0.0👤 User Management
# Create superuser (enhanced)
cli superuser --email [email protected]
# Standard Django way
python manage.py createsuperuser
# Test OTP authentication
python manage.py otp_test --email [email protected]
python manage.py otp_test --phone "+1234567890"🧪 Testing & Monitoring
# Check all API endpoints health (auto-resolves parametrized URLs)
python manage.py check_endpoints
# Check with JSON output for CI/CD
python manage.py check_endpoints --json
# Check without automatic JWT authentication
python manage.py check_endpoints --no-auth
# Check specific endpoint
python manage.py check_endpoints --url endpoints_status
# API endpoint for monitoring
curl http://localhost:8000/cfg/endpoints/
# Test email
cli test-email --to [email protected]
# Test Telegram
cli test-telegram --message "Hello!"🔄 Background Tasks (Django-RQ)
# Start async worker
rearq main:rearq worker
# Start cron task scheduler
rearq main:rearq timer
# Start monitoring web interface
rearq main:rearq server
# Start worker with specific queues
rearq main:rearq worker --queues default,high,low
# Test task processing
python manage.py test_tasks
# Start RQ worker
python manage.py rqworker
# Start RQ worker pool (multiple workers)
python manage.py rqworker_pool
# Start RQ scheduler
python manage.py rqscheduler
# Show queue statistics
python manage.py rqstats
# Clean stale job locks
python manage.py rq_cleanup_locks🌐 URLs & Routing
# Show all URLs (enhanced)
cli show-urls
# Filter URLs
cli show-urls --pattern "api/"
# Include admin URLs
cli show-urls --include-admin
# List URLs (alternative)
python manage.py list_urls --output urls.txt🛠️ Development Tools
# Run script with Django context
python manage.py script my_script.py
# Show project structure
python manage.py tree --depth 3
# Generate components
python manage.py generate model Product name:str price:decimal
# Create API token
python manage.py create_token username --expires-in 30
# Check settings
python manage.py check_settings --verbose
# Clear Constance cache
python manage.py clear_constance🌐 gRPC / Communication
# Start async gRPC server
python manage.py rungrpc
# Compile .proto files
python manage.py compile_proto
# Generate proto definitions from Django models
python manage.py generate_protos
# Create D1 schema tables for gRPC
python manage.py create_grpc_d1_schema☁️ Cloudflare D1
# Show D1 connection status
python manage.py cf_status
# Sync Django users to D1
python manage.py cf_sync_users
# View D1 operation logs
python manage.py d1_logs
# Create D1 schema for RQ events
python manage.py create_rq_d1_schema
# Create D1 schema for Centrifugo logs
python manage.py create_centrifugo_d1_schema📡 Centrifugo
# Generate typed Centrifugo clients (Python, TS, Go, Swift)
python manage.py generate_centrifugo_clients🖥️ Streamlit Admin
# Scaffold a new Streamlit admin app
python manage.py create_streamlit_app
# Start Streamlit admin server
python manage.py run_streamlit
# Generate Streamlit pages from models
python manage.py gen_streamlit⚙️ Code Generation
# Generate FastAPI/SQLModel code from Django models
python manage.py generate_fastapi
# Generate standalone API client
python manage.py generate_client📊 LLM & Monitoring
# Check OpenAI/OpenRouter API balance
python manage.py check_llm_balance
# Clean old monitor events
python manage.py monitor_cleanup🤖 Telegram
# Start Telegram bot in polling mode
python manage.py telegram_bot🔑 Auth / OTP
# Reset OTP throttle for a user
python manage.py otp_reset_throttle🌍 Geo
# Populate geo/timezone data
python manage.py geo_populate⏰ Cron Jobs
Commonly used commands in cron:
# Health check every 5 minutes
*/5 * * * * cd /path/to/project && python manage.py check_endpoints --json > /var/log/health.json🔗 Command Chaining
Useful command combinations:
# Complete project setup
django-cfg create-project my_project && \
cd my_project/projects/django && \
poetry install && \
poetry run python manage.py migrate && \
poetry run python manage.py createsuperuser
# Check and migrate
python manage.py check_settings && \
python manage.py migrate_all
# Deploy workflow
python manage.py check_settings --verbose && \
python manage.py migrate_all && \
python manage.py collectstatic --noinput
# Development startup
python manage.py migrate_all && \
python manage.py runserver_ngrok📋 Command Categories
| Category | Command Count | Main Purpose |
|---|---|---|
| Core | 7 | Project setup, configuration, validation |
| Database | 3 | Migrations, database management |
| Testing | 4 | Endpoint health, email, telegram, OTP |
| Background Tasks | 9 | Django-RQ workers, scheduler, stats |
| Development | 8 | Server, ngrok, scripts, testing |
| gRPC | 4 | gRPC server, proto compilation |
| Cloudflare D1 | 5 | D1 status, sync, logs, schemas |
| Centrifugo | 3 | WebSocket clients, publishing |
| Streamlit | 3 | Admin panel scaffolding, server |
| Code Generation | 2 | FastAPI, API client generation |
| LLM & Monitoring | 2 | API balance, event cleanup |
| Telegram | 1 | Bot polling mode |
| Auth / OTP | 1 | Throttle reset |
| Geo | 1 | Timezone/geo data |
💡 Tips
Use Poetry for Project Commands
# Recommended
poetry run cli runserver
# Also works
python manage.py runserverAlways Check Before Deploy
python manage.py check_settings --verboseUse Dry Run for Safety
python manage.py migrate_all --dry-runTest Integrations After Configuration
poetry run cli test-email --to [email protected]
poetry run cli test-telegram --message "Deploy successful"🔍 Find More Information
- Core Commands - Project setup, configuration
- Background Tasks - Django-RQ commands
- Development - Development tools
- Commands Overview - Full categorized list of all 50+ commands
Quick, focused, practical. Bookmark this page! 🚀
Last updated on