mercredi 8 février 2017

How to manage.py loaddata in Django

Vote count: 0

I've being fighting with this command for several hours now.

If I do

python manage.py dumpdata --natural-foreign --> data.json

when I loaddata I get the error

Could not load contenttypes.ContentType(pk=19): duplicate key value violates unique constraint "django_content_type_app_label_76bd3d3b_uniq" DETAIL: Key (app_label, model)=(misuper, stockitem) already exists.

Then if I do

python manage.py dumpdata --natural-foreign --exclude=contenttypes --> data.json

I get a similar error but with a ̣auth.Permission object.

And if I do

python manage.py dumpdata --natural-foreign --exclude=contenttypes --exclude=auth --> data.json

when I loaddata I get

User matching query does not exist

Of course, I'm excluding the auth table.

So ... how does the command loaddata work! :/

I believe the docs are insufficient.

asked 6 secs ago

Let's block ads! (Why?)



How to manage.py loaddata in Django

Aucun commentaire:

Enregistrer un commentaire