Cheat Sheet - Django

User Management

Reset admin password

python manage.py changepassword <user_name>

Database Management

Migrate data between different databases

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

# Reconfigure settings.py so it points to target database!!!!
# Generate schema on target database 
python manage.py migrate 

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

Create a migration

python manage.py makemigrations polls
python manage.py migrate

Dump current configuration (including defaults)

python manage.py diffsettings --all

See what SQL script a migration would run

python manage.py sqlmigrate polls 0001

Project management

Scaffold new project

django-admin startproject mysite

Manage.py commands

Start server

py manage.py runserver

Initiate database migration

py manage.py migrate

Create an app inside a project

py manage.py startapp polls

MSSQL Backend

mssql-backend

django-mssql-backend

django-mssql-backend-azure