Python Django中syncdb时过时的内容类型
当我为django项目尝试Python Django中syncdb时过时的内容类型,python,django,syncdb,contenttypes,Python,Django,Syncdb,Contenttypes,当我为django项目尝试syncdb时,我看到以下投诉: The following content types are stale and need to be deleted: myapp | Any objects related to these content types by a foreign key will also be deleted. Are you sure you want to delete these content types? If you're un
syncdb
时,我看到以下投诉:
The following content types are stale and need to be deleted:
myapp |
Any objects related to these content types by a foreign key will also
be deleted. Are you sure you want to delete these content types?
If you're unsure, answer 'no'.
虽然我也读过类似的问题,但我不能冒险键入yes
,因为我使用的是prod实例
yes
是否安全地删除contenttype中那些过时的条目?通常,您可以安全地删除它们,因为这些是不再存在模型的内容类型。
唯一需要注意的是,如果有其他模型通过
ForeignKey
指向ContentType
模型,这些对象也将被删除。如果您没有将任何外键设置为ContentType
,则不会发生任何不好的情况,如果您确实评估了是否仍需要将外键添加到要删除的内容类型的对象(如果有)。谢谢<代码>外键的确很重要。我想我必须在syncdb
之后进行验证以确保安全性。我有一个问题:每次运行“migrate”时,它都会请求它,即使我不碰任何东西。