Solutions to typeerror: expected string or bytes like object error

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 Because I deleted it on another project, it will not affect the operation of the project, just re-migrate.


Similar Posts: