The problem: when makingmigrations django does not see the model files. Error: No changes detected in app 'app_name'

Application structure:

app_name

  • models
  • a_folder

    • __init__.py
    • models3.py
  • __init__.py
  • models1.py
  • models2.py

Django version 2.2.0, python 3.7.2.

On the Internet, people advise in __init__.py to import all models, and it works. But. Before that, I created applications from which I also deleted the standard models.py, created the models folder, copied __init__.py into it, and there I created my own .py model files without importing them into __init__.py and everything migrated perfectly


@ m0nte-cr1st0 yes, @ Alexander was not originally migrating, because application is new.

  • Properly spelled __init__.py . Just in case, if this is not a typo - Alexander
  • Yes, in the prog init.py files with underscores. When publishing a topic, the site ate my '_' marks - Yuri Lug
  • @ Yuriy lug app hooked up in INSTALLED_APPS? - m0nte-cr1st0
  • @YuriLug, corrected the mapping - Grundy
  • In general, "no changes detected in app 'is not an error, but a notification that the migration program did not detect changes in the models for making changes in the database. They probably were, but she does not see them. You need to know: for some reason in jango, migrations work correctly only when deleting old files in the migration folder - Alexander

0