#31560: Circular imports raise AppRegistryNotReady.
------------------------------+--------------------------------------
     Reporter:  ExTexan       |                    Owner:  nobody
         Type:  Bug           |                   Status:  closed
    Component:  Core (Other)  |                  Version:  3.0
     Severity:  Normal        |               Resolution:  needsinfo
     Keywords:                |             Triage Stage:  Unreviewed
    Has patch:  0             |      Needs documentation:  0
  Needs tests:  0             |  Patch needs improvement:  0
Easy pickings:  0             |                    UI/UX:  0
------------------------------+--------------------------------------

Comment (by Heraldo Lucena):

 Replying to [comment:1 felixxm]:
 > Thanks for this report, Can you provide a sample project? All my
 attempts raise an `ImportError` (even with circular imports in `apps.py`)

 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.

 **Steps to reproduce**
 1. Create a django project and one app
 2. Create a Model in app/models.py
 3. In {{{ app/__init__.py }}} import the created model
 4. Add the app's dotted path to INSTALLED_APPS
 5. Try to run with {{{ ./manage.py runserver }}}
 You will get the error {{{ django.core.exceptions.AppRegistryNotReady:
 Apps aren't loaded yet. }}}
 Since it's caused by Django, I think Django should be able to detect it
 and output a meaning error message

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31560#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.7be052cebc7b65e9d6a00a1daaedec61%40djangoproject.com.

Reply via email to