/cheatsheets/django/django-manage-py-cheat-sheet
Django manage.py cheat sheet: project, migrations, users, testing
verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash)updated 2026-10-20
- tool
- Django
- versions
- Django 6.x
- os
- any
manage.py is the per-project command line for Django: it sets DJANGO_SETTINGS_MODULE and runs django-admin subcommands. Every command takes --help.
A new project, checked
django-admin startproject mysite . >/dev/null
python manage.py startapp blog
python manage.py check
python manage.py migrate -v 0
python manage.py showmigrations auth | head -4Output
System check identified no issues (0 silenced). auth [X] 0001_initial [X] 0002_alter_permission_name_max_length [X] 0003_alter_user_email_max_length
Project and apps
| Command | What it does |
|---|---|
| django-admin startproject mysite . | new project in the current folder |
| python manage.py startapp blog | new app (add it to INSTALLED_APPS) |
| python manage.py runserver 0.0.0.0:8000 | development server on all interfaces |
| python manage.py check --deploy | production settings checklist |
Database
| Command | What it does |
|---|---|
| makemigrations | create migrations from model changes |
| migrate | apply migrations |
| showmigrations | applied and pending migrations |
| sqlmigrate app 0001 | SQL of one migration |
| dbshell | open the database client |
| dumpdata app --indent 2 > data.json | export data as fixtures |
| loaddata data.json | import fixtures |
Users, shell, tests, static files
| Command | What it does |
|---|---|
| createsuperuser | admin user (interactive) |
| changepassword alice | reset a password |
| shell | Python shell with the project loaded |
| test blog --parallel | run tests of an app |
| collectstatic --noinput | gather static files into STATIC_ROOT |
Sources
Related pages
commands · djangopython manage.py makemigrations and migrate: create and apply migrationsmakemigrations turns model changes into migration files and migrate applies them to the database. Preview SQL with sqlmigrate, check state with showmigrations.config · djangoDjango ALLOWED_HOSTS: values, wildcards and DisallowedHost errorsALLOWED_HOSTS lists the host names a Django site may serve. Any other Host header raises DisallowedHost, a 400 error. Use exact names or .example.com.errors · djangoImproperlyConfigured: Requested setting …, but settings are not configuredDjango raises ImproperlyConfigured when code reads settings before DJANGO_SETTINGS_MODULE is set or settings.configure() runs. Set it, then call django.setup().