Python: Django exception when executing migrate operation: django.db.utils.OperationalError: (1051, “Unknown table’xxx’”)

Problem scenario:    When executing Python manage.py migrate, an error is reported (1051, “unknown table ‘xxx’),   At this time, there is no ‘xxx’ table in the database

Solution:
1. Comment out the tables in models.py that you failed to update

2. Execute after comments are dropped

python manage.py makemigrations

python manage.py migrate --fake

3. After the above execution is successful, cancel the table annotation in models.py

4. Cancel the comment and execute

python manage.py makemigrations

python manage.py migrate


Read More: