【发布时间】:2020-11-03 12:08:29
【问题描述】:
我正在尝试执行以下命令,但我收到了这个很长的错误。我也尝试过进入 dbshell 进行 trucanate,正如我在其他地方看到的建议,但我得到了 psql 未安装或未找到路径的错误,即使它应该是。
我已经成功地在 postgres 数据库中获取了我的表,但是除了一些我觉得奇怪的之外,它们都是空的。我的 Json 转储文件包含它需要的所有内容,但它不会转移。
有人有什么想法吗?
(venv) DEMOPROJECT>python manage.py loaddata "datadump.json"
Traceback (most recent call last):
File "\PycharmProjects\WebP1\venv\lib\site-packages\django\db\backends\utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "django_content_type_app_label_model_76bd3d3b_uniq"
DETAIL: Key (app_label, model)=(admin, logentry) already exists.
django.db.utils.IntegrityError: Problem installing fixture '\DEMOPROJECT\datadump.json': Could not load contenttypes.ContentType(pk=1): duplicate key value violates unique constraint "django_content_type_app_label_model_76bd3
d3b_uniq"
DETAIL: Key (app_label, model)=(admin, logentry) already exists.
【问题讨论】:
标签: python django postgresql