#30111: AppRegistryNotReady-Error when having contrib.postgres in INSTALLED_APPS
----------------------------------+--------------------------------------
     Reporter:  Jann Haber        |                    Owner:  (none)
         Type:  Bug               |                   Status:  new
    Component:  contrib.postgres  |                  Version:  2.2
     Severity:  Normal            |               Resolution:
     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 Nasir Hussain):

 Replying to [ticket:30111 Jann Haber]:
 Hi Jann,

 So I looked into the code and found the issue.

 When contrib.postgres is in INSTALLED_APPS it triggers from
 **django.db.migrations.writer import MigrationWriter** import in
 
[https://github.com/django/django/blob/7185ea6902532eb195d0575d1bf1492ca9d45dea/django/contrib/postgres/apps.py#L8
 django/django/contrib/postgres/apps.py] which further triggered
 **app_config = apps.get_containing_app_config(module)** import in
 
[https://github.com/django/django/blob/7185ea6902532eb195d0575d1bf1492ca9d45dea/django/db/models/base.py#L99
 ModelBase] Meta class.
 ModelBase checks for self.check_apps_ready() while apps have not been
 completely loaded yet. So an exception is raised **raise
 AppRegistryNotReady("Apps aren't loaded yet.")**
 I've changed **django/django/contrib/postgres/apps.py** to import
 MigrationWriter only when needed to avoid **check for apps ready** cycle
 to fix the issue


 [https://github.com/django/django/pull/10861 PR]

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30111#comment:2>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.c22c2b070a9f5cd5db5fd2e9df5493bb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to