i wanted to transform my data from sqlite database onto posgres database in django. first of all i write the command:
python -Xutf8 .manage.py dumpdata --indent=4 --output=data.json
to exporting data (in utf-8 encode) in a json file. everything was good and data exported properly, but when i want to import data in postgres (after configuration in settings.py) so i used
python .manage.py loaddata data.json
and got this error:
django.db.utils.IntegrityError: Problem installing fixture 'C:UsersBardiaDesktopwebappdata.json': Could not load contenttypes.ContentType(pk=7): duplicate key value violates unique constraint "django_content_type_app_label_model_76bd3d3b_uniq"
DETAIL: Key (app_label, model)=(blog, post) already exists.
can anyone help my in this situation?
thanks a lot
loading data in new postgres database in django
2
Answers
Thanks to a friend's answer and a bit of searching, my problem was solved with the following commands:
or do this:
Go to Python shell and clear all ContentType data