Linked Questions

Popular Questions

AUTH_USER_MODEL refers to model 'core.User' that has not been installed

Asked by At

I hope you are very well. Since a few hours ago I have an error in extending the "User" model of Django, this with the intention of adding some fields for different users.

To extend the model I relied on two main sources:

The Django repository on Github -

and from a Blog - simpleisbetterthancomplex -

Django version = 2.1

At the time of running the command - python makemigrations, I got the following error:

"AUTH_USER_MODEL refers to model '% s' that has not been installed"% settings.AUTH_USER_MODEL django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL refers to model 'core.User' that has not been installed

When wanting to define in - AUTH_USER_MODEL = 'core.User'

And yes, I have an application called "core" that is already in the INSTALLED_APPS

import os
from decouple import config
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# Quick-start development settings - unsuitable for production
# See

# SECURITY WARNING: keep the secret key used in production secret!

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = config('DEBUG', cast=bool)

ALLOWED_HOSTS = config('ALLOWED_HOSTS', cast=lambda v: [s.strip() for s in v.split(',')])

# Application definition



# custome user model
AUTH_USER_MODEL = 'core.User'

# Argon2 password hash


from __future__ import unicode_literals
from django.db import models
from django.core.mail import send_mail
from django.contrib.auth.models import PermissionsMixin
from django.contrib.auth.base_user import AbstractBaseUser
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone

from .managers import UserManager
from .validators import UnicodeUsernameValidator

# Create your models here.
class User(AbstractBaseUser, PermissionsMixin):
    An abstract base class implementing a fully featured User model with
    admin-compilant permissions

username and password are required, other fields are optional.
username_validator = UnicodeUsernameValidator()

username = models.CharField(
    help_text=_('Required: 150 Characters or fewer. Letters, digits and @/./+/-/_ only.'),
        'unique': _('A user with that username already exists.')
email = models.EmailField(_('Email Address'), unique=True)
first_name = models.CharField(_('First name'), max_length=50, blank=True)
last_name = models.CharField(_('Last name'), max_length=60, blank=True)
is_staff = models.BooleanField(
    _('Staff stauts'),
    help_text=_('Designates whether the user can log into this admin site.'),
is_active = models.BooleanField(
        'Designates whether this user should be treaged as active'
        'unselect this instead of deleting accounts'
is_company = models.BooleanField(_('User company permissions'), default=False)
date_joined = models.DateTimeField(_('date joined'),

objects = UserManager()

EMAIL_FIELD = 'email'
REQUIRED_FIELDS = ['email', 'username']

class Meta:
    verbose_name = _('user')
    verbose_name_plural = _('users')
    abstract = True

def clean(self):
    super().clean() = self.__class__.objects.normalize_email(

def get_full_name(self):
    Return the first_name plus the last_name, with a space in between
    full_name = '%s %s' %(self.first_name, self.last_name)
    return full_name.strip()

def get_short_name(self):
    Return the short name for the user
    return self.first_name

def email_user(self, subject, message, from_email=None, **kwargs):
    Send an email to this user
    send_mail(subject, message, from_email, [], **kwargs)

the ident in the code is fine but, here not haha


from django.apps import AppConfig

class CoreConfig(AppConfig):
    name = 'core'

Related Questions