#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            |       Keywords:
           Triage Stage:  Unreviewed        |      Has patch:  0
    Needs documentation:  0                 |    Needs tests:  0
Patch needs improvement:  0                 |  Easy pickings:  0
                  UI/UX:  0                 |
--------------------------------------------+------------------------
 After an upgrade to Django 2.2a1, I found the following problem:
 {{{
 $ python manage.py help
 /home/test/.virtualenvs/testenv/lib/python3.7/site-
 packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package
 will be renamed from release 2.8; in order to keep installing from binary
 please use "pip install psycopg2-binary" instead. For details see:
 <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
   """)
 Traceback (most recent call last):
   File "manage.py", line 21, in <module>
     main()
   File "manage.py", line 17, in main
     execute_from_command_line(sys.argv)
   File "/home/test/.virtualenvs/testenv/lib/python3.7/site-
 packages/django/core/management/__init__.py", line 381, in
 execute_from_command_line
     utility.execute()
   File "/home/test/.virtualenvs/testenv/lib/python3.7/site-
 packages/django/core/management/__init__.py", line 357, in execute
     django.setup()
   File "/home/test/.virtualenvs/testenv/lib/python3.7/site-
 packages/django/__init__.py", line 24, in setup
     apps.populate(settings.INSTALLED_APPS)
   File "/home/test/.virtualenvs/testenv/lib/python3.7/site-
 packages/django/apps/registry.py", line 91, in populate
     app_config = AppConfig.create(entry)
   File "/home/test/.virtualenvs/testenv/lib/python3.7/site-
 packages/django/apps/config.py", line 116, in create
     mod = import_module(mod_path)
   File "/usr/lib/python3.7/importlib/__init__.py", line 127, in
 import_module
     return _bootstrap._gcd_import(name[level:], package, level)
   File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
   File "<frozen importlib._bootstrap>", line 983, in _find_and_load
   File "<frozen importlib._bootstrap>", line 967, in
 _find_and_load_unlocked
   File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
   File "<frozen importlib._bootstrap_external>", line 728, in exec_module
   File "<frozen importlib._bootstrap>", line 219, in
 _call_with_frames_removed
   File "/home/test/.virtualenvs/testenv/lib/python3.7/site-
 packages/django/contrib/postgres/apps.py", line 8, in <module>
     from django.db.migrations.writer import MigrationWriter
   File "/home/test/.virtualenvs/testenv/lib/python3.7/site-
 packages/django/db/migrations/writer.py", line 10, in <module>
     from django.db.migrations.loader import MigrationLoader
   File "/home/test/.virtualenvs/testenv/lib/python3.7/site-
 packages/django/db/migrations/loader.py", line 8, in <module>
     from django.db.migrations.recorder import MigrationRecorder
   File "/home/test/.virtualenvs/testenv/lib/python3.7/site-
 packages/django/db/migrations/recorder.py", line 9, in <module>
     class MigrationRecorder:
   File "/home/test/.virtualenvs/testenv/lib/python3.7/site-
 packages/django/db/migrations/recorder.py", line 22, in MigrationRecorder
     class Migration(models.Model):
   File "/home/test/.virtualenvs/testenv/lib/python3.7/site-
 packages/django/db/models/base.py", line 99, in __new__
     app_config = apps.get_containing_app_config(module)
   File "/home/test/.virtualenvs/testenv/lib/python3.7/site-
 packages/django/apps/registry.py", line 252, in get_containing_app_config
     self.check_apps_ready()
   File "/home/test/.virtualenvs/testenv/lib/python3.7/site-
 packages/django/apps/registry.py", line 135, in check_apps_ready
     raise AppRegistryNotReady("Apps aren't loaded yet.")
 django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
 }}}

 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.

-- 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/048.8a358b12d42f814bc5a97b9a4db82ec1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to