Unable to create superuser in django getting error "django.db.utils.OperationalError: no such table: auth_user"

I am unable to create superuser in django.

Things I have done till now:

  1. Created Django Project

  2. Created Django App

  3. Went to settings.py added the app name in installed apps list

  4. Successfully able to runsever

  5. Tried creating a superuser using the command

python manage.py createsuperuser

Error received :

django.db.utils.OperationalError: no such table: auth_user

It would be very nice if someone could instruct me how to fix it.

P.S. : answer was posted by "michjnich" in comments so copy/pasting it here

You need to run migrations -

python manage.py migrate

It solves the issue.

The error django.db.utils.OperationalError: no such table: auth_user shows you don't have a table in your database named auth_user or has not applied some migrations since django comes with migrations that haven't been applied.

so in order to apply these migrations you need to run the command

python manage.py migrate

To apply the migrations and your good to proceed with your superuser creation

Back to Top