During the previous development project, data migration has been carried out many times, but after a period of time, when the data migration was reopened, a “TypeError: expected string or bytes-like object” type error occurred. The reason may be the inconsistency of the code in the program caused by the change of the database version, and the coding conflict caused by the existence of records during the previous migration. . . .
Of course, this is just my guess. As a Django novice, I am not quite clear about its internal structure. Hope to see the big guys can give pointers. Not much to say, the solution is as follows: I use xadmin background management,
So in the migrations directory corresponding to xadmi, delete the file starting with 0003_auto, and then re-migrate the data. In case it still doesn’t work, I personally think that you can delete all the files except _init_.py. Because I deleted it on another project, it will not affect the operation of the project, just re-migrate.
Similar Posts:
- [Solved] NodeNotFoundError(self.error_message, self.key, origin=self.origin) django.db.migrations.excep
- [Solved] You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for…
- [Solved] django.db.utils.ProgrammingError: (1146, u”Table” xxx doesn’t exist”)
- efcore Add-Migration Error Solved (Three Errors to Solved)
- [Solved] Django Error: – no such table: main.auth_user__old
- EntityFramework Enable-Migrations report exceptions “No context type was found in the assembly”
- The model backing the ‘XXX’ context has changed [Solved]
- [Solved] Djiango Create Migrations Error: query = query.decode(errors=’replace’) AttributeError: ‘str’ object has no attribute ‘decode’
- [How to Solve] dereferencing pointer to incomplete type
- When expdp uses the version parameter, ora-39373 is reported