我在嘗試添加內容或課程時遇到此錯誤。它工作正常,現在我得到這個錯誤。我已經將它上傳到heroku上,並且它工作正常,只是在本地開發中它不會添加任何內容。有人可以解釋什麼是錯誤的。請同時指定我應該添加哪些附加信息?IntegrityError at/admin/course/course/add/in django
IntegrityError at /admin/course/course/add/
insert or update on table "django_admin_log" violates foreign key constraint "django_admin_log_user_id_fkey"
DETAIL: Key (user_id)=(2) is not present in table "auth_user".
Request Method: POST
Request URL: http://127.0.0.1:8888/admin/course/course/add/
Django Version: 1.5.1
Exception Type: IntegrityError
Exception Value:
insert or update on table "django_admin_log" violates foreign key constraint "django_admin_log_user_id_fkey"
DETAIL: Key (user_id)=(2) is not present in table "auth_user".
Exception Location: /home/vagrant/sai/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py in _commit, line 240
Python Executable: /home/vagrant/sai/bin/python
Python Version: 2.7.3
快速和骯髒的解決方案:重置您的開發數據庫。 – abstractpaper
@abstractpaper我不知道後果..我仍然是新的django-dev ..任何干淨的soln。你可能會建議 – user2539745
重置你的開發環境數據庫不應該有嚴重的後果。唯一不利的一面是要重新創建一堆初始數據,你可以用燈具輕鬆解決。 – abstractpaper