Tag Archives: python manage.py makemigrations

[Solved] DjangoORM Run python manage.py makemigrations Error: no changes detected

no changes detected appears

python manage.py makemigrations
No changes detected

Why

When executing this command, he will go to all models and generate tables in the database

because sometimes when there are many app projects, he doesn’t know which model to look for and which model to generate the database table in

Here are models.Py

You need to add the name of the app project to the Django setting configuration file, such as CMDB

Then Django will go to the CMDB project to find models. Py to generate the database

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'cmdb',
]

 

python manage.py makemigrations
Migrations for 'cmdb':
  cmdb\migrations\0001_initial.py
    - Create model UserInfo

The generation of this representative succeeded