django

NOTE: A Django project may contain one or more apps

pip install Django will install Django

django-admin.py startproject <name_of_project> will create a new Django project with the following directory structure:

manage.py is the same as django-admin.py plus:

See django-admin and manage.py

python manage.py startapp <name_of_app> will create a new Django app within this project with the following directory structure:

Database

DB Tools:

Migrations:

Use manage.py graph_models to output DOT stream of database modeling. You can specify default settings in settings.py:

GRAPH_MODELS = {
  'all_applications': True,
  'group_models': True,
}

Sometimes you’ll make changes so drastic in a new project that it’s better to redo your migrations:

Django Admin

Django has an admin area (app) by default. Two Scoops believes its always easier to create a new admin then to override the defaults. The official Django documentation has information on overriding templates, adding new views, etc.

Users

TODO for implementing your User models:

REFERENCES

Two Scoops of Django: Best Practices for Django 1.8. Daniel Roy Greenfeld & Audrey Roy Greenfeld. 2015-05-15.

Tango with Django. Leif Azzopardi & David Maxwell. 2016-10-04. Seems best for developers without prior MVC experience.

The Django admin site. Django Documentation.