Django - makemigrations - No changes detected

前端 未结 30 1548
伪装坚强ぢ
伪装坚强ぢ 2020-12-02 04:44

I was trying to create migrations within an existing app using the makemigrations command but it outputs \"No changes detected\".

Usually I create new apps using the

30条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-02 05:41

    My problem (and so solution) was yet different from those described above.

    I wasn't using models.py file, but created a models directory and created the my_model.py file there, where I put my model. Django couldn't find my model so it wrote that there are no migrations to apply.

    My solution was: in the my_app/models/__init__.py file I added this line: from .my_model import MyModel

提交回复
热议问题