Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Django db迁移停止使用;Meta";班_Python_Django_Orm - Fatal编程技术网

Python Django db迁移停止使用;Meta";班

Python Django db迁移停止使用;Meta";班,python,django,orm,Python,Django,Orm,我正在尝试创建一个Django应用程序,在我的models.py文件中有这样一个类: class Identity(models.Model): display_name = models.CharField(db_column = "DisplayName", max_length = 200) 当我运行python manage.py makemigrations myApp时,一切都按预期工作,并为该类创建了一个迁移文件 如果模型中的类也定义了Meta类,则会出现问题: clas

我正在尝试创建一个Django应用程序,在我的
models.py
文件中有这样一个类:

class Identity(models.Model):
    display_name = models.CharField(db_column = "DisplayName", max_length = 200)
当我运行
python manage.py makemigrations myApp
时,一切都按预期工作,并为该类创建了一个迁移文件

如果模型中的类也定义了
Meta
类,则会出现问题:

class Identity(models.Model):
    display_name = models.CharField(db_column = "DisplayName", max_length = 200)
    class Meta:
        app_label = "something"
现在,如果我运行
makemigrations
命令,我会收到一条“未检测到任何更改”消息,并且不会生成任何迁移文件:

> python manage.py makemigrations myApp
No changes detected in app 'myApp'
请注意,这只是一个示例,如果我第一次在定义了
Meta
类的类上运行该命令,或者如果我删除以前生成的迁移文件,也会出现问题


我在Windows上使用的是Python 2.7.5和Django 1.9.5。

元类中没有这个,是吗

managed = False

元类中没有这个,是吗

managed = False

不,即使是我做的例子中的“app_标签”,我也会遇到这个问题……不,即使是我做的例子中的“app_标签”,我也会遇到这个问题。。。