2016-03-04 3 views
0

Я пытаюсь использовать это приложение https://github.com/benliles/django-chance в своем приложении. Моя версия Django - 1,9. Я получаю следующее сообщение об ошибке:Django 1.9: django.core.exceptions.AppRegistryNotReady: Приложения еще не загружены

python manage.py runserver 
Unhandled exception in thread started by <function wrapper at 0x7f4931ce85f0> 
Traceback (most recent call last): 
    File "/home/bewithaman/Projects/ems/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper 
    fn(*args, **kwargs) 
    File "/home/bewithaman/Projects/ems/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run 
    autoreload.raise_last_exception() 
    File "/home/bewithaman/Projects/ems/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 249, in raise_last_exception 
    six.reraise(*_exception) 
    File "/home/bewithaman/Projects/ems/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper 
    fn(*args, **kwargs) 
    File "/home/bewithaman/Projects/ems/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup 
    apps.populate(settings.INSTALLED_APPS) 
    File "/home/bewithaman/Projects/ems/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate 
    app_config = AppConfig.create(entry) 
    File "/home/bewithaman/Projects/ems/local/lib/python2.7/site-packages/django/apps/config.py", line 90, in create 
    module = import_module(entry) 
    File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module 
    __import__(name) 
    File "/home/bewithaman/Projects/Event-Management-System/chance/__init__.py", line 1, in <module> 
    from chance import signals 
    File "/home/bewithaman/Projects/Event-Management-System/chance/signals.py", line 7, in <module> 
    from chance.models import Registration 
    File "/home/bewithaman/Projects/Event-Management-System/chance/models.py", line 2, in <module> 
    from django.contrib.auth.models import User 
    File "/home/bewithaman/Projects/ems/local/lib/python2.7/site-packages/django/contrib/auth/models.py", line 4, in <module> 
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager 
    File "/home/bewithaman/Projects/ems/local/lib/python2.7/site-packages/django/contrib/auth/base_user.py", line 49, in <module> 
    class AbstractBaseUser(models.Model): 
    File "/home/bewithaman/Projects/ems/local/lib/python2.7/site-packages/django/db/models/base.py", line 94, in __new__ 
    app_config = apps.get_containing_app_config(module) 
    File "/home/bewithaman/Projects/ems/local/lib/python2.7/site-packages/django/apps/registry.py", line 239, in get_containing_app_config 
    self.check_apps_ready() 
    File "/home/bewithaman/Projects/ems/local/lib/python2.7/site-packages/django/apps/registry.py", line 124, in check_apps_ready 
    raise AppRegistryNotReady("Apps aren't loaded yet.") 
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet. 

Файл дерева сайта: -

├── chance 
│   ├── admin.py 
│   ├── admin.pyc 
│   ├── forms.py 
│   ├── forms.pyc 
│   ├── __init__.py 
│   ├── __init__.pyc 
│   ├── migrations 
│   │   ├── 0001_initial.py 
│   │   ├── 0002_add_eventchoice_allow_multiple.py 
│   │   ├── 0002_add_eventchoice_allow_multiple.pyc 
│   │   ├── 0003_add_created_and_label.py 
│   │   ├── 0004_add_registration_owner.py 
│   │   ├── __init__.py 
│   │   └── __init__.pyc 
│   ├── models.py 
│   ├── models.pyc 
│   ├── signals.py 
│   ├── signals.pyc 
│   ├── templates 
│   │   └── chance 
│   │    ├── event_detail.html 
│   │    ├── event_list.html 
│   │    ├── registration_email_manager_subject.txt 
│   │    ├── registration_email_subject.txt 
│   │    ├── registration_email.txt 
│   │    └── registration_form.html 
│   ├── urls.py 
│   ├── urls.pyc 
│   ├── views.py 
│   └── views.pyc 
├── EMS 
│   ├── __init__.py 
│   ├── __init__.pyc 
│   ├── settings.py 
│   ├── settings.pyc 
│   ├── urls.py 
│   ├── urls.pyc 
│   ├── wsgi.py 
│   └── wsgi.pyc 
├── manage.py 
├── media 
│   └── profile_images 
│    ├── 20140810_175920.jpg 
│    ├── IMG-20150215-WA0013.jpg 
│    ├── IMG-20150215-WA0015.jpg 
│    ├── IMG-20150215-WA0018-1.jpg 
│    ├── IMG-20150304-WA0005.jpg 
│    └── Shubham_20140216_234708-1.jpg 
├── notifications 
│   ├── admin.py 
│   ├── admin.pyc 
│   ├── apps.py 
│   ├── apps.pyc 
│   ├── __init__.py 
│   ├── __init__.pyc 
│   ├── migrations 
│   │   ├── 0001_initial.py 
│   │   ├── 0001_initial.pyc 
│   │   ├── __init__.py 
│   │   └── __init__.pyc 
│   ├── models.py 
│   ├── models.pyc 
│   ├── signals.py 
│   ├── signals.pyc 
│   ├── static 
│   │   └── notifications 
│   │    └── notify.js 
│   ├── templates 
│   │   └── notifications 
│   │    ├── list.html 
│   │    ├── notice.html 
│   │    └── test_tags.html 
│   ├── templatetags 
│   │   ├── __init__.py 
│   │   ├── __init__.pyc 
│   │   ├── notifications_tags.py 
│   │   └── notifications_tags.pyc 
│   ├── tests 
│   │   ├── __init__.py 
│   │   ├── settings.py 
│   │   ├── static 
│   │   │   └── notifications 
│   │   │    └── live-test.js 
│   │   ├── templates 
│   │   │   └── test_live.html 
│   │   ├── tests.py 
│   │   ├── urls.py 
│   │   └── views.py 
│   ├── urls.py 
│   ├── urls.pyc 
│   ├── utils.py 
│   ├── utils.pyc 
│   ├── views.py 
│   └── views.pyc 
├── registeration 
│   ├── admin.py 
│   ├── admin.pyc 
│   ├── forms.py 
│   ├── forms.pyc 
│   ├── __init__.py 
│   ├── __init__.pyc 
│   ├── migrations 
│   │   ├── 0001_initial.py 
│   │   ├── 0001_initial.pyc 
│   │   ├── 0002_auto_20160211_1250.py 
│   │   ├── 0002_auto_20160211_1250.pyc 
│   │   ├── 0003_event_participants.py 
│   │   ├── 0003_event_participants.pyc 
│   │   ├── __init__.py 
│   │   └── __init__.pyc 
│   ├── models.py 
│   ├── models.pyc 
│   ├── tests.py 
│   ├── urls.py 
│   ├── urls.pyc 
│   ├── views.py 
│   └── views.pyc 
├── static 
│   ├── css 
│   │   ├── bootstrap.css 
│   │   ├── bootstrap-fluid-adj.css 
│   │   ├── bootstrap.min.css 
│   │   ├── bootstrap-responsive.css 
│   │   └── bootstrap-responsive.min.css 
│   ├── img 
│   │   ├── glyphicons-halflings.png 
│   │   ├── glyphicons-halflings-white.png 
│   │   └── twd.ico 
│   └── js 
│    ├── bootstrap.js 
│    ├── bootstrap.min.js 
│    ├── jquery-2.0.3.js 
│    ├── jquery-2.0.3.min.js 
│    └── rango-ajax.js 
└── templates 
    └── registeration 
     ├── base.html 
     ├── events.html 
     ├── index.html 
     ├── login.html 
     ├── profile.html 
     └── register.html 

Я следовал всем инструкциям, но я не могу понять, что это неправильно. Пожалуйста, помогите мне.

ответ

5

Приложение django-chance, которое вы используете, не обновлялось через несколько лет и, похоже, не поддерживает Django 1.9. Вместо этого вы можете использовать другое приложение или попытаться обновить его для работы с Django 1.9.

Эта часть трассировки показывает, что она импортирует signals.py в __init__.py, которая пытается импортировать модели до загрузки приложений.

File "/home/bewithaman/Projects/Event-Management-System/chance/__init__.py", line 1, in <module> 
    from chance import signals 
    File "/home/bewithaman/Projects/Event-Management-System/chance/signals.py", line 7, in <module> 
    from chance.models import Registration 

Удалите эту строку из файла chance/__init__.py

from chance import signals 

Затем создайте change/apps.py файл, и определить класс конфигурации приложения, который импортирует сигналы в методе ready().

from django.apps import AppConfig 

class ChanceConfig(AppConfig): 

    def ready(self): 
     from . import signals 

Наконец, обновите настройку INSTALLED_APPS, чтобы использовать вашу конфигурацию.

INSTALLED_APPS = [ 
    ... 
    'chance.apps.ChanceConfig', 
    ... 
] 
+0

Thanks @Alasdair – bewithaman

Смежные вопросы