[Django]-Django error: relation "users_user" does not exist

49👍

Inside your user app, you should have a folder migrations. It should only contain 0001_initial.py and __init__.py. Is that correct?

Try running ./manage.py sqlmigrate user 0001_initial and see what it does, because thats where the error comes from

2👍

Another issue can also be the fact that you were using the database for another application. So if this can be the case just drop the database before making migrations again

1👍

I’ve also encountered with the same issue in Postgres DB.

Steps to follow:

  • remove previous db and create new one
  • add migration folder and add init.py empty file inside migration folder of each app having models
  • now use command python manage.py makemigrations
  • use command python manage.py migrate

0👍

I had the same issues, and what I did was to run python manage.py makemigrations <app_name> and do not forget to add <app_name> to INSTALLED_APPS in your settings.py file

Leave a comment