Django Integrity Error amb loaddata

Si fent una importació de dades amb Django mitjançant la comanda:
 
./manage.py loaddata  
 
i us apareix el següent error: 
IntegrityError: duplicate key value violates unique constraint "django_content_type_app_label_key"

The problem is simply that you're getting the content types defined twice - once when you do syncdb, and once from the exported data you're trying to import. Since you may well have other items in your database that depend on the original content type definitions, I would recommend keeping those.
So, after running syncdb, do manage.py dbshell and in your database do TRUNCATE django_content_type; to remove all the newly-defined content types. Then you shouldn't get any conflicts - on that part of the process, in any case.


Resposta Original (Stackoverflow)

Comentaris

Entrades populars d'aquest blog

L'Europa del S. X al S.XIX

Array of pointers in Fortran

Renda fixa