Django 1.9: django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet

后端 未结 1 1031
小蘑菇
小蘑菇 2021-01-26 02:29

I am trying to use this app https://github.com/benliles/django-chance in my application. My Django version is 1.9. I am getting the following error:

python mana         


        
相关标签:
1条回答
  • 2021-01-26 03:20

    The django-chance app you are using has not been updated in several years, and does not appear to support Django 1.9. You can either use a different app instead, or try to update it to work with Django 1.9.

    This part of the traceback shows that it imports signals.py in the __init__.py, which tries to import models before the apps are loaded.

      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
    

    Remove this line from your chance/__init__.py file

    from chance import signals
    

    Then create an change/apps.py file, and define an app config class that imports the signals in the ready() method.

    from django.apps import AppConfig
    
    class ChanceConfig(AppConfig):
    
        def ready(self):
            from . import signals
    

    Finally, update your INSTALLED_APPS setting to use your config.

    INSTALLED_APPS = [
        ...
        'chance.apps.ChanceConfig',
        ...
    ]
    
    0 讨论(0)
提交回复
热议问题