Skip to Content
CLIIntroduction

CLI Tools Introduction

Django-CFG ships a small Click command, django-cfg, for creating projects and checking the installation. Everything else is a Django management command run with python manage.py.

Overview

The CLI system includes:

  • django-cfg create-project - Bootstrap a new Django project from the latest template
  • django-cfg info - Check installation status and dependencies
  • Management commands - python manage.py <command> for settings, URLs, migrations, health checks, RQ, code generation and more

Installation

The CLI is automatically available after installing Django-CFG:

# Create virtual environment (Python 3.12+ required) python3.12 -m venv .venv && source .venv/bin/activate # Install Django-CFG pip3 install 'django-cfg[full]' # Verify CLI is available django-cfg --help

Quick Start

Create a New Project

# Create project in current directory django-cfg create-project "My Awesome Project" # Create project in specific location django-cfg create-project "My Project" --path ./projects/ # Overwrite an existing directory django-cfg create-project "My Project" --force

Check System Information

# Basic information django-cfg info # Detailed information with paths django-cfg info --verbose

Management Commands

Django-CFG adds its own management commands next to the standard ones:

# In your Django-CFG project directory cd my_project/ # Enhanced runserver with better output poetry run python manage.py runserver 0.0.0.0:8080 # Smart migrator with automatic database detection poetry run python manage.py migrator --auto # Check settings and diagnostics poetry run python manage.py check_settings --verbose # Show project URLs in table format poetry run python manage.py show_urls --format table # Superuser creation poetry run python manage.py superuser --email [email protected]

Features

Rich Output

The commands print colored output with the Rich library:

  • ✅ Success indicators with green checkmarks
  • ⚠️ Warnings with yellow alerts
  • ❌ Errors with red crosses
  • 📦 Progress indicators for long operations
  • 🎨 Syntax highlighting for code and configuration

Smart Defaults

  • Auto-detection of Poetry vs pip environments
  • Intelligent fallbacks when commands fail
  • Environment-aware configuration loading
  • Dependency checking with helpful error messages

Command Categories

Project Management

  • create-project - Create new Django projects
  • info - System and installation information

Management commands (python manage.py ...)

  • migrator, migrate_all - Smart database migrations
  • check_settings - Configuration validation and diagnostics
  • show_config - Display current configuration
  • show_urls, list_urls - List URL patterns
  • superuser - Superuser creation
  • test_email, test_telegram - Test email and Telegram integration
  • gen - Generate API clients
  • log_noise - Rank repeated log lines (--stdin)

Integration with Django

Standard Django commands keep working; the commands above are added by the django_cfg app:

python manage.py runserver python manage.py migrate python manage.py migrator --auto # smart database detection

Command Reference

Core Commands

Feature-Specific Commands

Guides & Configuration

Tips & Best Practices

  1. Use Poetry - Django-CFG projects work best with Poetry for dependency management
  2. Enable Auto-completion - Most terminals support Click auto-completion:
    # Bash eval "$(_DJANGO_CFG_COMPLETE=bash_source django-cfg)" # Zsh eval "$(_DJANGO_CFG_COMPLETE=zsh_source django-cfg)"
  3. Check Dependencies - Use django-cfg info --verbose to verify your setup
  4. Read Help - Every command has detailed help with --help flag
  5. Chain Commands - Combine multiple commands for complex workflows
  6. Use Environment Variables - Configure defaults via DJANGO_CFG_* environment variables

The CLI is designed to make Django development faster, safer, and more enjoyable! 🚀

See Also

CLI Commands

Core Commands:

Feature Commands:

Getting Started

Project Setup:

Configuration:

Features & Deployment

Built-in Apps:

Deployment:

Last updated on