Django 1.8:删除迁移文件夹后未检测到迁移 [英] Django 1.8: Migrations not detected after deleting migrations folder
问题描述
我不小心删除了迁移文件夹,现在python manage.py makemigrations不会检测到我的模型中的更改。我该怎么办?
I accidentally deleted the migrations folder and now python manage.py makemigrations does not detect the changes in my models. What do I do?
shubham@shubham-PC:~/Documents/try/ecommerce$ python manage.py makemigrations
No changes detected
存储库是这里
推荐答案
尝试使用 python manage.py makemigrations app_name
。
编辑:Django可让您在项目中拥有没有迁移的应用。这是通过迁移
文件夹检测到的。如果一个应用没有应用程序,则在使用 python manage.py makemigrations
命令时不会创建迁移,尽管您在 INSTALLED_APPS
。要强制应用程序使用迁移,您需要指定应用程序的名称。 Btw,对于使用新版本的Django创建的应用程序,这不是必需的,因为它们是使用迁移
文件夹创建的。删除迁移文件夹(如您所做)或使用旧版本的Django创建的应用程序时,这只需要。
Django allows you to have apps without migrations within your projects. This is detected with the migrations
folder. If an app does not have it, it won't create the migrations when using the python manage.py makemigrations
command although you have it in INSTALLED_APPS
. To force an application to work with migrations you need to specify the name of the application. Btw, this is not necessary for applications you create with new versions of Django because they are created with the migrations
folder. This is only necessary when you remove the migrations folder (as you did) or when working with applications created with older versions of Django.
这篇关于Django 1.8:删除迁移文件夹后未检测到迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!