0

I am trying to migrate a database from a local computer(Windows, SQLite3) to a server(Ubuntu 20, PostgreSQL).

I created a JSON dump from local SQLite3 base.

python manage.py dumpdata > dump.json

On the server, I enter into the shell and executed the commands

from django.contrib.contenttypes.models import ContentType
ContentType.objects.all().delete()
quit()

And when i'm trying to refill database

python manage.py loaddata dump.json

The console responds with this

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

I would be very grateful if you could explain to me how to fix the problem.

Huzkuy
  • 1
  • 1
  • 1
    Your JSON is probably in ANSI with BOM while Ubuntu expect it in UTF-8. Convert it to the ad-hoc encoding. As a reminder a backup is not safe until you have the guarantee that you can recover from it. – jlandercy Jul 21 '22 at 22:18
  • [This](https://stackoverflow.com/questions/2137501/django-dumpdata-utf-8-unicode) did not help? – Umut TEKİN Jul 22 '22 at 00:04

0 Answers0