Changes between Initial Version and Version 1 of Ticket #31560, comment 3


Ignore:
Timestamp:
Jul 3, 2020, 4:21:08 PM (4 years ago)
Author:
HMaker

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #31560, comment 3

    initial v1  
    22> Thanks for this report, Can you provide a sample project? All my attempts raise an `ImportError` (even with circular imports in `apps.py`)
    33
    4 I had this problem and managed to debug it right now. It will happen when Django's app registry imports the app's module added in INSTALLED_APPS and that module imports, directly or indirectly, a model of the app being loaded. Reading the docs [https://docs.djangoproject.com/en/3.0/ref/applications/] there are no notes warning about it.
     4I had this problem and managed to debug it right now. It will happen when Django's app registry imports the app's module added in INSTALLED_APPS and that module imports, directly or indirectly, a model of the app being loaded . Reading the docs [https://docs.djangoproject.com/en/3.0/ref/applications/] there are no notes warning about it.
    55
    66**Steps to reproduce**
     
    10104. Add the app's dotted path to INSTALLED_APPS
    11115. Try to run with {{{ ./manage.py runserver }}}
    12 You will get the error {{{ django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet. }}}
     12You will get the error {{{ django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet. }}}. At a model's import time, the model metaclass will check whether its app is ready, but it is not, so the AppRegistryNotReady will be raised since the registry is being populated.
     13
    1314Since it's caused by Django, I think Django should be able to detect it and output a meaning error message
Back to Top