Django-makemigrations-未检测到更改 [英] Django - makemigrations - No changes detected

查看:133
本文介绍了Django-makemigrations-未检测到更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用makemigrations命令在现有应用程序中创建迁移,但输出未检测到更改。

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

通常,我使用<$创建新应用c $ c> startapp 命令,但在创建该应用时未将其用于此应用。

Usually I create new apps using the startapp command but did not use it for this app when I created it.

调试后,我发现它不是创建迁移是因为应用程序中缺少 migrations 软件包/文件夹。

After debugging, I found that it is not creating migration because the migrations package/folder is missing from an app.

如果不存在该文件夹或者创建丢失的文件夹会更好吗?

Would it be better if it creates the folder if it is not there or am I missing something?

推荐答案

要为应用创建初始迁移,请运行 makemigrations 并指定应用名称。

To create initial migrations for an app, run makemigrations and specify the app name. The migrations folder will be created.

./manage.py makemigrations <myapp>

您的应用必须首先包含在 INSTALLED_APPS 中(在settings.py内部)。

Your app must be included in INSTALLED_APPS first (inside settings.py).

这篇关于Django-makemigrations-未检测到更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆