错误xadmin django1.7.3

时间:2015-01-21 02:57:46

标签: django

/home/lrqrun/.virtualenvs/timesheetv2_env/bin/python2.7 

/home/lrqrun/workspace/timesheetv2/src/manage.py runserver localhost:8080

回溯

Traceback (most recent call last):
  File "/home/lrqrun/workspace/timesheetv2/src/manage.py", line 9, in <module>
    execute_from_command_line(sys.argv)
  File "/home/lrqrun/.virtualenvs/timesheetv2_env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/home/lrqrun/.virtualenvs/timesheetv2_env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute
    django.setup()
  File "/home/lrqrun/.virtualenvs/timesheetv2_env/local/lib/python2.7/site-packages/django/__init__.py", line 21, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/lrqrun/.virtualenvs/timesheetv2_env/local/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "/home/lrqrun/.virtualenvs/timesheetv2_env/local/lib/python2.7/site-packages/django/apps/config.py", line 202, 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 "/home/lrqrun/.virtualenvs/timesheetv2_env/local/lib/python2.7/site-packages/xadmin/models.py", line 19, in <module>
    AUTH_USER_MODEL = django.contrib.auth.get_user_model()
  File "/home/lrqrun/.virtualenvs/timesheetv2_env/local/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 137, in get_user_model
    return django_apps.get_model(settings.AUTH_USER_MODEL)
  File "/home/lrqrun/.virtualenvs/timesheetv2_env/local/lib/python2.7/site-packages/django/apps/registry.py", line 199, in get_model
    self.check_models_ready()
  File "/home/lrqrun/.virtualenvs/timesheetv2_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.

一步一步地白化文档https://xadmin.readthedocs.org/en/latest/quickstart.html,但发现错误,

问题:

这是因为没有xadmin的django1.7.3吗?

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。在我的案例中,我找到了解决问题的方法。我的环境是django 1.7.6,xadmin 0.5.0。我在xadmin中更改了名为models.py的源文件。

if django.VERSION[1] >4:已更改为if 4 < django.VERSION[1] < 7:,然后问题已修复。