To reproduce (running python 3.7.2):
Make a new python3 venv (python3 -m venv) and activate. Install django and
psycopg2 using pip. Use django-admin.py startproject to get a fresh
installation of django. Add contrib.postgres to INSTALLED_APPS. Run the
command above, which should display the help messages. The same thing
happens also with any other manage.py command.
--
Ticket URL: <https://code.djangoproject.com/ticket/30111>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Old description:
New description:
2.2a1 and psycopg2 using pip. Use django-admin.py startproject to get a
fresh installation of django. Add contrib.postgres to INSTALLED_APPS. Run
the command above, which should display the help messages. The same thing
happens also with any other manage.py command.
Note: The same thing is working with no problem when running Django 2.1.5
--
--
Ticket URL: <https://code.djangoproject.com/ticket/30111#comment:1>
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>
* status: new => assigned
* owner: (none) => Nasir Hussain
--
Ticket URL: <https://code.djangoproject.com/ticket/30111#comment:3>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/30111#comment:4>
* severity: Normal => Release blocker
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/30111#comment:5>
* cc: jon.dufresne@… (added)
Comment:
This was caused by #29738 [as bisected by
Jon](https://code.djangoproject.com/ticket/29738#comment:14).
--
Ticket URL: <https://code.djangoproject.com/ticket/30111#comment:6>
* cc: jon.dufresne@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/30111#comment:6>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/30111#comment:7>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"2804b8d2153505ec49b191db2168302dfb92c3af" 2804b8d2]:
{{{
#!CommitTicketReference repository=""
revision="2804b8d2153505ec49b191db2168302dfb92c3af"
Fixed #30111 -- Fixed AppRegistryNotReady error with
django.contrib.postgres in INSTALLED_APPS.
Regression in e192223ed996ed30fe83787efdfa7f2be6b1a2ee.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30111#comment:8>
Comment (by Tim Graham <timograham@…>):
In [changeset:"6ce7887f1387855df2cda180da08277febedd02e" 6ce7887f]:
{{{
#!CommitTicketReference repository=""
revision="6ce7887f1387855df2cda180da08277febedd02e"
[2.2.x] Fixed #30111 -- Fixed AppRegistryNotReady error with
django.contrib.postgres in INSTALLED_APPS.
Regression in e192223ed996ed30fe83787efdfa7f2be6b1a2ee.
Backport of 2804b8d2153505ec49b191db2168302dfb92c3af from master.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30111#comment:9>
Comment (by Tim Graham <timograham@…>):
In [changeset:"2de7eb6f4d5a20cec98e4d2eefc276ee38d149ad" 2de7eb6f]:
{{{
#!CommitTicketReference repository=""
revision="2de7eb6f4d5a20cec98e4d2eefc276ee38d149ad"
Refs #30111 -- Fixed test cleanup in postgres_tests/test_integration.py.
Fixed "ERROR: Step ‘Publish JUnit test result report’ failed: No test
report
files were found. Configuration error?" on Jenkins because report files
were
put in tests/postgres_tests.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30111#comment:10>
Comment (by Tim Graham <timograham@…>):
In [changeset:"710052fee9372306b5d8f46957b3660eee2cac68" 710052f]:
{{{
#!CommitTicketReference repository=""
revision="710052fee9372306b5d8f46957b3660eee2cac68"
[2.2.x] Refs #30111 -- Fixed test cleanup in
postgres_tests/test_integration.py.
Fixed "ERROR: Step ‘Publish JUnit test result report’ failed: No test
report
files were found. Configuration error?" on Jenkins because report files
were
put in tests/postgres_tests.
Backport of 2de7eb6f4d5a20cec98e4d2eefc276ee38d149ad from master.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30111#comment:11>