I have a PostgreSQL database that where I performed python manage.py dumpdata to backup the data into a json file. I created a new PostgreSQL database, performed a migrate, and everything worked like clockwork. When I tried to load the backup.json file with python manage.py loaddata backup.json it, gives me this error.
Could not load contenttypes.ContentType(pk=15): duplicate key value violates unique constraint "django_content_type_app_label_76bd3d3b_uniq"
DETAIL: Key (app_label, model)=(navigation, navigation) already exists.
I checked phpPgAdmin, and there is a row for News. Is there a way to load the backup json file without including the content types, or better yet dump everything except for content types data ?
pg_restore
and djangoloaddata
. This article clearly explains these differences and possible solutions - deephacks.com/articles/entry/… But as @Vao Tsun advices, it would be better to find these constraint issues deep into your data. – Ailssa