Django: Fextures

Now I'm learning to make projects on Django and faced such a problem. I have a database with products, and I also have a dump json file. I made this file with the command python manage.py dumpdata products.Product > allproduct.json. I deleted the database file to add a new field in the admin (weird way to add new functionality, I agree). After running the migration commands python manage.py makemigrations python manage.py migrate. The project was already working as it should, and now I needed to return all the products to their place. This had to be done with the command python manage.py loaddata loaddata products/fixtures/allproduct.json. At this point, I'm stuck because the error UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte is displayed. I googled and showed how to fix this error with simple examples like opening a file via with open('file.txt', encoding="utf8") ....


Ответы (0 шт):