简体   繁体   中英

django 1.7 relation “auth_user” does not exist in migrate but fine in tests

I'm updating a django-1.5 project to django-1.7.2 and when migrating I keep getting "relation "auth_user" does not exist". However if I run python manage.py test -v2 to see the process of database creation/migration

Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying subscription.0001_initial... OK

Migrations turn out fine. Am I missing a step? It is my belief that one does not need to syncdb anymore simply

python manage.py migrate

But doing that does not apply migrations for django apps.

Note: I'm not using a custom User class just the regular django.contrib.auth.models.User

May be you faked auth migrations already on real database?

Try to check

select * from django_migrations where app='auth'

and if any records exists, delete them.

You need to do 2 things:

python manage.py makemigrations

and then

python manage.py migrate

The migrate does indeed apply the migrations, but they first need to be created. These two steps are more or less the replacement of the old syncdb.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM