django.db.utils.IntegrityError: duplicate key value violates unique constraint “django_content_type_pkey”

前端 未结 5 1781
春和景丽
春和景丽 2020-12-31 00:43

Ran into a bit of a problem, i\'m getting the above error message when i run \'python manage.py syncdb\' I\'m working on a fairly old site. It\' running django

5条回答
  •  悲&欢浪女
    2020-12-31 01:30

    Although I am not 100% certain this is the problem, there is a good chance your sequence is out of date.

    Does executing this within Postgres solve the issue?

    SELECT setval('django_content_type_id_seq', (SELECT MAX(id) FROM django_content_type));
    

提交回复
热议问题