How to dump sqlite data into postgresql
1.
python manage.py dumpdata > custom_name.json
2. Create your postgres username and database
3.
# install this package
pip install psycopg2
settings.py
DATABASES = {
‘default’: {
‘ENGINE’: ‘django.db.backends.postgresql_psycopg2’,
‘NAME’: ‘db_name’,
‘USER’ : ‘db_username’,
‘PASSWORD’ : ‘db_password’,
‘HOST’ : ‘localhost’,
‘PORT’ : ‘5452’,
}
}
4. Delete migrations folder and __init__.py and run python manage.py makemigrations and python manage.py migrate
5.
Also, delete the content types(mandatory steps) to avoid numerous errors as follow:
python manage.py shell
from django.contrib.contenttypes.models import ContentType
ContentType.objects.all().delete()
6.
python manage.py loaddata custom_name.json
If you need assistance with your projects feel free to email me at info@airgad.com or whatsapp Jesse stay safe!