Django 11 ImproperlyConfigured: AUTH_USER_MODEL refers to model 'authex.UserProfile' that has not been installed

10,667 views
Skip to first unread message

cjacq...@gmail.com

unread,
Oct 29, 2017, 3:10:58 PM10/29/17
to Django users
Hi everyone,

I'm trying to update Django from 1.10.8 to 1.11.6 but it raise me an error.

I just update Django with pip. I use Python 2.7.11 and Mac OS X and everything was working on Django 1.10.8.


Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/django/utils/autoreload.py", line 228, in wrapper
    fn(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
    autoreload.raise_last_exception()
  File "/Library/Python/2.7/site-packages/django/utils/autoreload.py", line 251, in raise_last_exception
    six.reraise(*_exception)
  File "/Library/Python/2.7/site-packages/django/utils/autoreload.py", line 228, in wrapper
    fn(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Library/Python/2.7/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models()
  File "/Library/Python/2.7/site-packages/django/apps/config.py", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/Users/Colas/PyCharmProjects/assoweb/authex/models.py", line 6, in <module>
    from django.contrib.auth.admin import UserAdmin
  File "/Library/Python/2.7/site-packages/django/contrib/auth/admin.py", line 7, in <module>
    from django.contrib.auth.forms import (
  File "/Library/Python/2.7/site-packages/django/contrib/auth/forms.py", line 22, in <module>
    UserModel = get_user_model()
  File "/Library/Python/2.7/site-packages/django/contrib/auth/__init__.py", line 198, in get_user_model
    "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 'authex.UserProfile' that has not been installed


Any ideas ? Thanks !

Colas

James Schneider

unread,
Oct 30, 2017, 2:56:48 AM10/30/17
to django...@googlegroups.com
  File "/Library/Python/2.7/site-packages/django/contrib/auth/forms.py", line 22, in <module>
    UserModel = get_user_model()
  File "/Library/Python/2.7/site-packages/django/contrib/auth/__init__.py", line 198, in get_user_model
    "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 'authex.UserProfile' that has not been installed


Any ideas ? Thanks !


Does INSTALLED_APPS in your settings.py file contain an entry for 'authex'? 

-James

cjacq...@gmail.com

unread,
Oct 30, 2017, 3:35:44 AM10/30/17
to Django users

Yes, there is my INSTALLED_APPS (it was ok with Django 1.10) :

INSTALLED_APPS = [
#django
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'django.contrib.flatpages',
'django.contrib.humanize',
#third-parties
'bootstrapform',
'django_bleach',
'django_tables2',
'easy_thumbnails',
'emoticons',
'form_utils',
'mathfilters',
'tinymce',
#assoweb
'airfield',
'authex',
'blog',
'challenge',
'core',
'django_resource',
'files',
'help',
'mailing',
'questionnaire',
'section',
'treasury',
'year',
]

And later :

AUTH_USER_MODEL = 'authex.UserProfile'

Thanks for helping. :)

cjacq...@gmail.com

unread,
Oct 30, 2017, 4:20:14 AM10/30/17
to Django users
An additional information : the settings.py was generated with Django 1.9.7

cjacq...@gmail.com

unread,
Oct 30, 2017, 9:57:39 AM10/30/17
to Django users
Ok, i finally found where the problem was : the admin class (UserAdmin) of my custom user class was in models.py and must be in admin.py.

I found the solution here : https://stackoverflow.com/questions/45783147/django-lookuperror-app-accounts-doesnt-have-a-user-model
Reply all
Reply to author
Forward
0 new messages