这是场景:
我正在使用 django 的管理界面,我希望能够通过固定装置加载用户和组(如果可能的话。)我可以像这样转储用户/组:
manage.py dumpdata auth auth.group > usersandgroups.json
但是在将数据加载到全新的数据库中时...
manage.py loaddata <appname>/fixtures/usersandgroups.json
我遇到与外键等有关的各种错误。这是一个例子:
django.db.utils.IntegrityError: insert or update on table "auth_permission" violates foreign key constraint "content_type_id_refs_id_728de91f"
DETAIL: Key (content_type_id)=(37) is not present in table "django_content_type".
如果有人能指出我正确的方向,我将不胜感激。提前致谢!