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:
- [Solved] Django Configurate celery error: django.db.utils.DatabaseError
- [Solved] Python Django error: error: (1146, “Table ‘mydb.django_session’ doesn’t exist”)
- [Solved] Django project locally Open Error: importerror: couldn’t import Django
- [Solved] Django Error: django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
- Django uses Mysql to report an error loading MySQL DB module: no module named ‘mysqldb’
- [Solved] flask db migrate execute error: ERROR [flask_migrate] Error: Can‘t locate revision identified by ‘8d1ad59dc71a‘
- Django Error: binascii.Error: Incorrect padding [How to Solve]
- [Solved] Python Project Error: django.core.exceptions.ImproperlyConfigured: WSGI application ‘WebTool.wsgi.application
- [Solved] Django.core.exceptions.ImproperlyConfigured: SQLite 3.9.0 or later is required (found 3.7.17).
- [Solved] Python sqlite3.OperationalError: near “?“: syntax error
- [Solved] django AttributeError: ‘UserComment‘ object has no attribute ‘save‘
- [Solved] django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.Did you install mysqlclie
- Django Error: ‘polls‘ is not a registered namespace
- [Solved] Django backend error: Assertion failed: (NSViewIsCurrentlyBuildingLayerTreeForDisplay()
- Django Issues: TypeError: “Settings” object is irreversible
- Django PythonConsole error: Requested setting DEFAULT_INDEX_TABLESPACE
- Django WSGI protocol application, based on wsgiref module DIY a web framework
- [Solved] Django backend processing Base64 file upload error
- [Solved] Django Error: Attributeerror: ‘wsgirequest’ object has no attribute ‘is_ajax ‘