南装时不识别型号

发布于 2024-09-24 17:04:39 字数 464 浏览 1 评论 0原文

我使用 South 为我的 Django 站点进行架构和数据迁移。我很高兴使用它。有一天,我将 models.py 文件转换为 models/__init__py 并将一些额外的模型放在 models/something.py 中。当我运行 python manage.py schemamigration app --auto 时,尽管 something.py< 中有新类,但我收到了 Nothing似乎没有改变。 消息/代码>。如果我将它们复制到 __init__py 文件中,South 就会识别出新模型。我尝试从 __init__py 顶部的 something 导入所有内容,但没有任何变化。

I use South for schema and data migraton for my Django site. I'm happy about using it. One day I converted models.py file to models/__init__py and put some additional models at models/something.py. When I ran python manage.py schemamigration app --auto, I got the Nothing seems to have changed. message despite of the new classes at something.py. If I copied them to the __init__py file, South had recognized the new models. I tried to import everything from something in the top of __init__py, but no change.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

野稚 2024-10-01 17:04:39

这是姜戈设计的。 Django 根本不选择你的模型,你需要设置 < code>app_label 在模型的 Meta 类中。

请参阅在不使用 app_label Meta 属性的情况下自动发现包中的模型

It's Django design. Django is not picking your models at all, you need to set app_label in your model's Meta class.

See ticket on Automatically discover models within a package without using the app_label Meta attribute.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文