Back to Cheat Sheets

Django Management Commands

Frequently used Django management commands for project and app maintenance.

Action Command Details
Start new project django-admin startproject <name> Create a new Django project folder structure.
Create app python manage.py startapp <app> Generate a new app inside the project.
Run server python manage.py runserver Start the local development server at http://127.0.0.1:8000.
Make migrations python manage.py makemigrations Detect model changes and create migration scripts.
Apply migrations python manage.py migrate Apply migrations to sync database schema.
Create superuser python manage.py createsuperuser Create admin user to access Django admin interface.
Collect static files python manage.py collectstatic Copy all static files to STATIC_ROOT for production.
Show URLs python manage.py show_urls List all URL patterns (requires django-extensions).
Clear cache python manage.py clear_cache Clear the configured cache backend (if supported).
Run tests python manage.py test Run the automated test suite for the project.
Check issues python manage.py check Perform system checks for common errors and warnings.
Shell python manage.py shell Open an interactive Python shell with Django environment loaded.
DB shell python manage.py dbshell Open the database shell client for direct queries.
Start Celery worker celery -A proj worker -l info Start Celery task queue worker (external command).
Show migrations python manage.py showmigrations List all migrations and their applied status.
Flush database python manage.py flush Remove all data from the database (preserves schema).
Run custom command python manage.py <command> Execute a custom management command.
LoopPlunk
Support Us