First to INSTALLED_APPS in settings.py
, you need to set all apps which you want to make migrations and migrate for as shown below:
# "settings.py"
INSTALLED_APPS = [
'app1',
'app2'
]
Then, run the command below which can make migrations for all apps set in INSTALLED_APPS
in settings.py
:
python manage.py makemigrations
Then, run the command below which can migrate for all apps set in INSTALLED_APPS
in settings.py
:
python manage.py migrate
In addition, you can make migrations for specific multiple apps by specifying them as shown below:
python manage.py makemigrations app1 app2
But, if you specify the apps which are not set in INSTALLED_APPS
in settings.py
as shown below:
python manage.py makemigrations app1 app2 app3 app4
Then, there are the errors below so no migrations are made for all the specified apps:
No installed app with label 'app4'.
No installed app with label 'app3'.
In addition, you can migrate for only one specific app by specifying it as shown below:
python manage.py migrate app1
But, you cannot migrate for multiple specific apps by specifying them as shown below:
python manage.py migrate app1 app2
Then, there is the error below:
CommandError: Cannot find a migration matching 'app2' from app 'app1'.