Tonight, I ran into a pretty tough error and wanted to document it so someone else may be able to fix it quicker than I did! I have mostly relied on Heroku for deployment, but there are always major headaches when I deploy
So here is the deal this time. My auth_user table did not populate when I ran my original migrations. This means that when I create a super user, they still do not get privileges.
Here is the error:
insert or update on table “django_admin_log” violates foreign key constraint “django_admin_log_user_id_c564eba6_fk_auth_user_id”
DETAIL: Key (user_id)=(1) is not present in table “auth_user”
I found the solution on this article python - insert or update on table “django_admin_log” violates foreign key constraint - Stack Overflow
"
Migrate the problematic apps to zero
python manage.py migrate admin zero
And the Run migrations again
python manage.py migrate admin
P.S. If that’s a custom apps then you may want to fake rollback only few migrations instead of initials. (Artem Dumanov)"