我将South用于Django网站的架构和数据迁移。我很高兴使用它。有一天,我将models.py
文件转换为models/__init__py
,并在models/something.py
上放置了一些其他模型。当我运行python manage.py schemamigration app --auto
时,尽管有了Nothing seems to have changed.
上的新类,但还是收到了something.py
消息。如果我将它们复制到__init__py
文件,South将识别出新模型。我尝试从something
顶部的__init__py
导入所有内容,但没有更改。
最佳答案
这是Django设计。 Django根本不选择模型,您需要在模型的Meta类中设置 app_label
。
请参阅Automatically discover models within a package without using the app_label
Meta attribute上的票证。