Create Django app with no User model - 3.1.3 wants to migrate auth_user?

Viewed 42

I've got a Django application which has been happily humming along now for quite some time (2 years or so).

It's on 3.0.10 currently - when I tried to upgrade to 3.1.3, it says there was a migration for the auth application. No worries! Never been an issue before...

I ran python manage.py migrate and got the following error:

"Cannot find the object "auth_user" because it does not exist or you do not have permissions."

Which, I suppose would be true because we do not have a User model at all in this application. There is no auth_user table, that is correct. In other apps we have an AbstractUser that routes to a table named: org_user - but again:

this particular app (and project) do not have any User model associated with them

Obviously this (apparently, now) leads to some issues.

Any thoughts on how to get around this? I thought about removing auth from installed apps and tried that but it led to more issues when trying to runserver.

2 Answers

You can fake a migration using --fake option:

python manage.py migrate --fake auth
python manage.py migrate

But I suspect the error you get could be symptomatic of a project design issue, such as not setting properly settings.AUTH_USER_MODEL

Solution 1 :- Run these commands :-

    python manage.py migrate auth

    python manage.py migrate

Solution 2 :- Try to copy your Project in another folder and then run migrations.

Related