Questions & Answers

Why do I get a "auth_user does not exist"error when running "migrate" on a newly created django project with "registration redux" app installed?

Given a newly created django project with the following installed apps:


When I run ./ migrate for the first time I get the following error:

Operations to perform:
  Synchronize unmigrated apps: staticfiles, messages, registration
  Apply all migrations: sessions, admin, auth, contenttypes
Synchronizing apps without migrations:
  Creating tables...
    Creating table registration_registrationprofile
    Running deferred SQL...
Traceback (most recent call last):
  File "./", line 10, in <module>
  File "/Users/tcosta/Virtualenvs/django_project/lib/python2.7/site-packages/django/core/management/", line 338, in execute_from_command_line
  File "/Users/tcosta/Virtualenvs/django_project/lib/python2.7/site-packages/django/core/management/", line 330, in execute
  File "/Users/tcosta/Virtualenvs/django_project/lib/python2.7/site-packages/django/core/management/", line 390, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/tcosta/Virtualenvs/django_project/lib/python2.7/site-packages/django/core/management/", line 441, in execute
    output = self.handle(*args, **options)
  File "/Users/tcosta/Virtualenvs/django_project/lib/python2.7/site-packages/django/core/management/commands/", line 179, in handle
    created_models = self.sync_apps(connection, executor.loader.unmigrated_apps)
  File "/Users/tcosta/Virtualenvs/django_project/lib/python2.7/site-packages/django/core/management/commands/", line 317, in sync_apps
  File "/Users/tcosta/Virtualenvs/django_project/lib/python2.7/site-packages/django/db/backends/", line 79, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/Users/tcosta/Virtualenvs/django_project/lib/python2.7/site-packages/django/db/backends/", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/Users/tcosta/Virtualenvs/django_project/lib/python2.7/site-packages/django/db/", line 97, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/Users/tcosta/Virtualenvs/django_project/lib/python2.7/site-packages/django/db/backends/", line 62, in execute
    return self.cursor.execute(sql)
django.db.utils.ProgrammingError: relation "auth_user" does not exist```

It seems Django is trying to create the registration tables before the user table.

This erros does not happen if I comment the registration app and run migrate and then uncomment the registration app and run migrate again. However, that's not the right way of doing it, right?

2023-05-26 23:55:20
Django migrations should be able to specify dependencies to determine order, so the registration migration could probably use a dependency to auth.User. Since it's a library, I'm not really sure what the solution is here. Perhaps the order of INSTALLED_APPS?
2023-05-26 23:55:20
I've already changed the order of INSTALLED APPS but it didn't work! :( Thanks by the way.
2023-05-26 23:55:20
To "solve" it I had to create all migrations for all apps and then I launched a migrate and it worked.… (Pedro's asnwer)
2023-05-26 23:55:20
I am having same issue. python migrate migrates all apps in correct order with auth first on mysql5.6 but when I move to mysql5.7, I see this issue.
Answers(8) :

I had this problem too, solved it by replacing old registration with one that includes pull #25:

pip install git+

In my case, this has been resolved re-adding some modules in INSTALLED_APPS that had been removed. As a consequence, some tables in the database were confusing the migration scheme and then ruining the test command because the default database was containing those previous migrations.

Fixed re-adding the modules, allauth and other related submodules in my case.

Once you create a migration for your app it will automatically add the necessary dependencies. So in this case just run ./ makemigrations registration.

Please check the registration/migrations/ file and you should see something like this:

dependencies = [

This means you need to create migrations for all your apps with any kind of dependency.

I think you needed to run:

python syncdb

and potentially you need to setup some dependencies? Probably not necessary after syncdb.

South 1 style (Django < 1.7)

class Migration:

    depends_on = (
        ("accounts", "0001"),

    def forwards(self):

South 2 style (Django >= 1.7)

from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [("accounts", "0001")]

After updating my Django version, I got this error and fix as running these two lines:

python migrate auth
python migrate

auth_user table inside auth model should run first I guess.

2023-05-26 23:55:21
And if it looks like is packed away somewhere, it's okay, you can still use it- # python /usr/lib/python2.7/dist-packages/graphite/ migrate auth
2023-05-26 23:55:21
At long last, the answer I needed. A gazillion answers saying to run manage makemigrations and manage migrate but this is the first I've seen that mentions manage migrate auth. Is this due to originating my app with Django 1.6 and upgrading along the way to 2.0 now? Or are most of these answers just incomplete?
2023-05-26 23:55:21
More people need to see this answer. It solved my issue after a lot of searching. Thank you.

The problem is avoided when you do as Pedro Wagner suggests (auth_user error with Django 1.8 and syncdb / migrate):

Make sure that for all your apps, there exist initial migrations files by running: makemigrations my_app

I'd do it not only for those that depend on auth because I think the problem is more general.

The root cause for this behaviour seems to me that for some reason makemigrations

does not always create the initial migrations if they are not already there, contrary to: makemigrations my_app

Unfortunately I cannot fathom the reasons for this asymmetry.

2023-05-26 23:55:21
This was super Helpful

you have not migrated your models

python makemigrations my_app_name

for mac os

python3 makemigrations my_app

I think you just forgot to migrate your auth models. However, to do that, just type in the following command on your terminal.

python migrate 


python migrate auth

Hope this settles your error in the program.