Currently I\'m using Django 1.11 and Python 3.6. I\'m attempting to create a custom user model with a new application that authenticates with LDAP, but i\'m greeted with th
Alternatively, you can also try:
python manage.py migrate <app_name>
on the app that contains the custom user model.python manage.py migrate
to apply the rest of the migrations of the app. The reason why this works is that you're applying the changes of the new User model first before you applied the rest of the auth
model that's built in Django.
not sure if I explained that right
This:
This is caused by your settings.AUTH_USER_MODEL having changed to a model that does not exist when migrations are being computed.
... mentioned by @AKX in their answer gave me an idea which worked.
I did the following:
User
model into place. Set AUTH_USER_MODEL
in settings.py
and update any uses of django.contrib.auth.models.User
with your custom user model.python manage.py makemigrations
python manage.py migrate
For me helped split on two migration
AUTH_USER_MODEL = 'accounts.User'
) AUTH_USER_MODEL
to settings.py
and other connections with new tableBut it works for dev/production databases if you want to apply migrations from first in tests or another from scratch database creations you should "compact your migrations", for me it was next steps:
sqldump
)django_migrations
)manage.py makemigrations
manage.py migrate
django_migrations
in your dump (maybe some other django_*
tables )