2. A Django Project and Its First Model
The starter repo is currently just a few configuration files.
In this chapter, we'll install Django, see what its startproject command generates, and cover:
- Projects and apps: What a project contains, what an app is for, and the settings that install our apps and connect the project to a Postgres database running in Docker.
- Models: Defining our own models, including
Animal, and usingTextChoicesto limit a field to a fixed set of values. - Migrations: Turning our Python models into database tables with
makemigrationsandmigrate, and creating and saving anAnimalfrom the Django shell.