【问题标题】:`migrate` fails to detect new model`migrate` 无法检测到新模型
【发布时间】:2018-08-12 15:39:06
【问题描述】:

我刚刚在project/posts/models.py 中创建了一个新模型,但manage.py migrate 完成但没有创建新模型。同样,manage.py makemigrations 也没有检测到任何更改并返回 No changes detected。有谁知道为什么没有检测到新模型?

【问题讨论】:

    标签: django django-models django-migrations


    【解决方案1】:

    您的应用程序posts 是否在您的settings.py 文件中的INSTALLED_APPS 中列出?这可能是问题所在。

    你也可以试试:

    manage.py makemigrations posts
    

    【讨论】:

    • 不是,但我有project.posts.apps.AppConfig,其中包含一个扩展AppConfig 的类。够吗?
    猜你喜欢
    • 2014-12-21
    • 2018-12-11
    • 1970-01-01
    • 1970-01-01
    • 2015-07-20
    • 2017-10-22
    • 2023-03-05
    • 2018-01-06
    • 2012-08-20
    相关资源
    最近更新 更多