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 script a migration would run

python sqlmigrate polls 0001

Project management

Scaffold new project

django-admin startproject mysite commands

Start server

py runserver

Initiate database migration

py migrate

Create an app inside a project

py startapp polls

MSSQL Backend