Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Django 1.7 problem(AppRegistryNotReady) #230

Closed
alexsilva opened this issue Oct 1, 2014 · 7 comments
Closed

Django 1.7 problem(AppRegistryNotReady) #230

alexsilva opened this issue Oct 1, 2014 · 7 comments

Comments

@alexsilva
Copy link
Contributor

Python 2.7

My Url:

from django.conf.urls import patterns, include, url
import xadmin

xadmin.autodiscover()

urlpatterns = patterns('',
    url(r'^xadmin/', include(xadmin.site.urls))
) 

My settings:

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'xadmin',
    'crispy_forms'
)

Exception on runserver:

/env/bin/python /path/manage.py runserver 8000
Traceback (most recent call last):
  File "/path/manage.py", line 12, in <module>
    execute_from_command_line(sys.argv)
  File "/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute
    django.setup()
  File "/env/local/lib/python2.7/site-packages/django/__init__.py", line 21, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/env/local/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "/env/local/lib/python2.7/site-packages/django/apps/config.py", line 197, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/env/local/lib/python2.7/site-packages/xadmin/models.py", line 19, in <module>
    AUTH_USER_MODEL = django.contrib.auth.get_user_model()
  File "/env/local/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 136, in get_user_model
    return django_apps.get_model(settings.AUTH_USER_MODEL)
  File "/env/local/lib/python2.7/site-packages/django/apps/registry.py", line 199, in get_model
    self.check_models_ready()
  File "/env/local/lib/python2.7/site-packages/django/apps/registry.py", line 131, in check_models_ready
    raise AppRegistryNotReady("Models aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.
@alexsilva
Copy link
Contributor Author

Django 1.7

get_user_model() only works at run time.

https://code.djangoproject.com/ticket/21875

Only that to fix the problem:

AUTH_USER_MODEL = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')

@sshwsfc
Copy link
Owner

sshwsfc commented Oct 3, 2014

Please use django1_7 branch.

@sshwsfc sshwsfc closed this as completed Oct 3, 2014
@qrilka
Copy link

qrilka commented Nov 24, 2014

Any plans to merge it into master and publish a new version?

@wangshunping
Copy link

@alexsilva where to set AUTH_USER_MODEL = getattr(settings, 'AUTH_USER_MODEL', 'auth.User') ?

I have the same question

@alexsilva
Copy link
Contributor Author

@wangshunping
This problem has been fixed in xadmin, but if you do not understand how custom user works read.
extending-the-existing-user-model

@sebschlo
Copy link

I just tried using xadmin with a pre existing app by following the instructions in the documentation and am getting this same error. I am running django 1.10.4 and I have also extended the user model myself, I don't know if that may have something to do with the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants