Skip to content

Migrations

About makemigrations and migrate and sqlmigrate and django_migrations table, app-specific vs overall, version control etc.

Using models

After defining your models, you need to let Django know about them by adding your app to INSTALLED_APPS in settings.py.

For example, if your app is named myapp:

python
INSTALLED_APPS = [
    # ...
    "myapp",
    # ...
]

Once added, run the following commands to create database tables for your models:

shell
python manage.py makemigrations  # create migrations file
python manage.py migrate         # apply them to the database