Django拒绝运行,抛出CommandError

时间:2016-06-23 21:23:49

标签: django django-migrations django-contenttypes

我必须在对服务器进行整理后恢复备份,现在Django不断抛出系统检查命令错误。

    account.Customer.country: (fields.E300) Field defines a relation with model 'Country', which is either not installed, or is abstract.
account.Customer.state: (fields.E300) Field defines a relation with model 'State', which is either not installed, or is abstract.
account.Customer.user: (fields.E304) Reverse accessor for 'Customer.user' clashes with reverse accessor for 'Customer.user'.
        HINT: Add or change a related_name argument to the definition for 'Customer.user' or 'Customer.user'.
account.Customer.user: (fields.E305) Reverse query name for 'Customer.user' clashes with reverse query name for 'Customer.user'.
        HINT: Add or change a related_name argument to the definition for 'Customer.user' or 'Customer.user'.
account.CustomerNote.author: (fields.E304) Reverse accessor for 'CustomerNote.author' clashes with reverse accessor for 'CustomerNote.author'.
        HINT: Add or change a related_name argument to the definition for 'CustomerNote.author' or 'CustomerNote.author'.
account.EmailChangeRequest.user: (fields.E304) Reverse accessor for 'EmailChangeRequest.user' clashes with reverse accessor for 'EmailChangeRequest.user'.
        HINT: Add or change a related_name argument to the definition for 'EmailChangeRequest.user' or 'EmailChangeRequest.user'.
account.SecurityAnswer.user: (fields.E304) Reverse accessor for 'SecurityAnswer.user' clashes with reverse accessor for 'SecurityAnswer.user'.
        HINT: Add or change a related_name argument to the definition for 'SecurityAnswer.user' or 'SecurityAnswer.user'.
account.UserSession.user: (fields.E304) Reverse accessor for 'UserSession.user' clashes with reverse accessor for 'UserSession.user'.
        HINT: Add or change a related_name argument to the definition for 'UserSession.user' or 'UserSession.user'.
customer.Customer.user: (fields.E304) Reverse accessor for 'Customer.user' clashes with reverse accessor for 'Customer.user'.
        HINT: Add or change a related_name argument to the definition for 'Customer.user' or 'Customer.user'.
customer.Customer.user: (fields.E305) Reverse query name for 'Customer.user' clashes with reverse query name for 'Customer.user'.
        HINT: Add or change a related_name argument to the definition for 'Customer.user' or 'Customer.user'.
customer.CustomerNote.author: (fields.E304) Reverse accessor for 'CustomerNote.author' clashes with reverse accessor for 'CustomerNote.author'.
        HINT: Add or change a related_name argument to the definition for 'CustomerNote.author' or 'CustomerNote.author'.
security.EmailChangeRequest.user: (fields.E304) Reverse accessor for 'EmailChangeRequest.user' clashes with reverse accessor for 'EmailChangeRequest.user'.
        HINT: Add or change a related_name argument to the definition for 'EmailChangeRequest.user' or 'EmailChangeRequest.user'.
security.SecurityAnswer.user: (fields.E304) Reverse accessor for 'SecurityAnswer.user' clashes with reverse accessor for 'SecurityAnswer.user'.
        HINT: Add or change a related_name argument to the definition for 'SecurityAnswer.user' or 'SecurityAnswer.user'.
security.UserSession.user: (fields.E304) Reverse accessor for 'UserSession.user' clashes with reverse accessor for 'UserSession.user'.
        HINT: Add or change a related_name argument to the definition for 'UserSession.user' or 'UserSession.user'.

此版本和数据库以前工作过。我已经检查过 settings.py ,并且已经安装了他们抱怨的应用。此外,related_name错误似乎是引用自己。

我已尝试使用update_all_contenttypes模块中的django.contrib.contenttypes.management方法清除内容类型并重新填充它们。该表现在似乎是正确的,但仍然会出现这些错误。

1 个答案:

答案 0 :(得分:1)

好的,我发布之后就知道了。在项目重组之前,我有一些流氓models.pyc文件,这些文件在不同的应用程序中定义了相同的模型。清除所有这些文件解决了问题。我想我需要在部署过程中完成这一部分。

相关问题