connect project to new database

for replacing sqlite database with postgres, the below commands are used:

python -Xutf8 manage.py dumpdata --natural-foreign --exclude=auth.permission --exclude=contenttypes --indent=4 > data.json

python manage.py migrate

python manage.py loaddata data.json

I counter an error in last step (loaddata):
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xff in position 0: invalid start byte

1 Like

Did you try without the Xutf8 to dumbdata?

Yes. I ran both codes.

Did you try to open and save the data.json in utf-8 encoding?

I converted data.json to UTF-8 using a web app and then replaced it with the old data.json file in the project directory. The problem was solved.

Nice. Mark the post as the solution in order to help other users of the community.

heyy which web app you used to solve this please tell