Django Cheat Sheet

This is a cheat sheet or minimal tutorial of django.


sudo -H pip install django

And check django version is: python -m django --version

First step

start a django project by: django-admin startproject mysite
run the project by: python runserver
the default port is 8000, if want to run on a different port,
The command is: python runserver 8080

the command to create a app is: python startapps polls

Cheat sheet on apps

polls/ manage the view codes;
polls/ manage the router codes
mysite/ manage global router.

Cheat sheet on database

python migrate will apply database changes of apps registerd in INSTALLED_APPS, which defined in mysite/
python makemigrations polls will notify django than the database of this app is changed.

Cheat seet on shell

python shell will preparing a shell environement of the django environment


if want apps managed by the django backend, need to register it in apps/