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 templatedjango-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 --helpQuick 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" --forceCheck System Information
# Basic information
django-cfg info
# Detailed information with paths
django-cfg info --verboseManagement 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 projectsinfo- System and installation information
Management commands (python manage.py ...)
migrator,migrate_all- Smart database migrationscheck_settings- Configuration validation and diagnosticsshow_config- Display current configurationshow_urls,list_urls- List URL patternssuperuser- Superuser creationtest_email,test_telegram- Test email and Telegram integrationgen- Generate API clientslog_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 detectionCommand Reference
Core Commands
- Core Commands - Essential project management commands (info, create-project, check-settings)
- Development Commands - Development server, migrations, debugging tools
- Custom Commands - Create your own management commands
Feature-Specific Commands
- Background Task Commands - Manage Django-RQ workers and tasks
Guides & Configuration
- Configuration Guide - Configure CLI behavior and defaults
- Production Best Practices - CLI usage in production
- Troubleshooting - Common CLI issues
Tips & Best Practices
- Use Poetry - Django-CFG projects work best with Poetry for dependency management
- 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)" - Check Dependencies - Use
django-cfg info --verboseto verify your setup - Read Help - Every command has detailed help with
--helpflag - Chain Commands - Combine multiple commands for complex workflows
- 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:
- Core Commands - Essential project management commands
- Development Commands - Development server and debugging tools
- Custom Commands - Create your own management commands
- Quick Reference - Command cheat sheet
Feature Commands:
- Background Task Commands - Manage Django-RQ workers
Getting Started
Project Setup:
- Installation - Install Django-CFG
- First Project - Complete tutorial
- Configuration Guide - Configure your project
- Why Django-CFG - Benefits and features
Configuration:
- Configuration Models - All configuration options
- Type-Safe Configuration - Pydantic patterns
- Environment Detection - Multi-environment setup
- Environment Variables - Secrets management
Features & Deployment
Built-in Apps:
- Built-in Apps Overview - All available apps
- User Management - Accounts and support
Deployment:
- Docker Deployment - Containerized deployment
- Production Config - Production best practices
- Environment Setup - Environment configuration
- Troubleshooting - Common CLI issues