I generated a fixture:
python manage.py dumpdata --all > ./mydump.json
I emptied all my databases using:
python manage.py sqlflush | psql mydatabase -U mydbuser
But when i try to use loaddata:
python manage.py loaddata ./mydump.json
I'm recieving this error:
IntegrityError: Could not load tastypie.ApiKey(pk=1): duplicate key
value violates unique constraint "tastypie_apikey_user_id_key"
DETAIL: Key (user_id)=(2) already exists.
I'm having this problem on production and i'm out of ideas. Someone had a similar problem?
Run loaddata
with all @reciever
s commented out because they will be fired when loaddata
loads your data. If @reciever
s create other objects as a sideeffect it will cause collisions.