Cheat Sheet - Django

Cheat Sheet - Django

User management

Reset admin password

python changepassword <user_name>

Database management

Migrate data between different databases

# Make sure points to source database 
# Dump data 
python dumpdata --all --format json --indent 2 --output C:\Temp\Fulldump.json 

# Reconfigure so it points to target database!!!!
# Generate schema on target database 
python migrate 

# Reload data 
python loaddata --verbosity 3 --format json C:\Temp\Fulldump.json 

Create a migration

python makemigrations polls
python migrate

Dump current configuration (including defaults)

python diffsettings --all

See what SQL a migration would run

python sqlmigrate polls 0001

Project management

Scafold new project

django-admin startproject mysite commands

Start server

py runserver

Initiate database

py migrate

Create an app inside project

py startapp polls

MSSQL Backends



  • Doesn't fully work with the latest 3.2.5 version (py sqlmigrate throws exceptions, which are gone with 2.2.24)
  • Lacks AAD support


  • Only for Django 2.x


  • Does work with Django 2.2.24
  • Doesn't work with django 3.2.5, 3.1.13