Search code examples
djangodjango-migrationsdjango-contenttypes

Django refusing to run, throwing CommandError


I had to restore a backup after bricking my server and now Django keeps throwing a System Check CommandError.

    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'.

This build and DB worked before. I've checked settings.py and the apps it's complaining about are installed. Also, the related_name errors seem to be referencing themselves.

I've tried clearing the content types and re-populating them using the update_all_contenttypes method in the django.contrib.contenttypes.management module. The table seems to be correct now, but still getting these errors.


Solution

  • Okay, right after I posted this I figured it out. I had some rogue models.pyc files lying around before the project restructuring that were defining the same models but in different apps. Clearing out all of those files fixed the issue. I need to make that part of my deploy process I guess.