You cannot change the AUTH_USER_MODEL setting during the lifetime of a
project (i.e. once you have made and migrated models that depend on it)
without serious effort. It is intended to be set at the project start, and
the model it refers to must be available in the first migration of the app
that it lives in. See Substituting a custom User model for more details.
}}}
This is a big issue for developers that don't realize you must create a
custom user before the first migration.
**Solution:**
When first starting a project using
{{{
$ django-admin startproject mysite
}}}
Django should also by default create an app named 'users' that contains a
ready-made User model in **project_folder -> users -> models.py** which
could then be customized there if needed.
And obviously add these default settings to Django **AUTH_USER_MODEL =
'users.User'** and **INSTALLED_APPS = [ 'users' ... ]**
--
Ticket URL: <https://code.djangoproject.com/ticket/33684>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => duplicate
* component: contrib.auth => Core (Management commands)
Comment:
Duplicate of #27909.
--
Ticket URL: <https://code.djangoproject.com/ticket/33684#comment:1>