我将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上的票证。

10-07 19:07
查看更多