Opened 6 hours ago

Last modified 3 hours ago

#36224 assigned Bug

django-admin shell raises AppRegistryNotReady

Reported by: Raffaella Owned by: Sarah Boyce
Component: Core (Management commands) Version: 5.2
Severity: Release blocker Keywords: shell
Cc: Raffaella, Natalia Bidart, Salvo Polizzi Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I tried to open the shell with django-admin shell after installing Django 5.2b1, but I got this error. The problem could be related to the new feature of automatic models import in the shell.

Traceback (most recent call last):
  File "/Users/raffi/PycharmProjects/debug-tutorial/.venv/bin/django-admin", line 8, in <module>
    sys.exit(execute_from_command_line())
             ~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/Users/raffi/PycharmProjects/debug-tutorial/.venv/lib/python3.13/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
    ~~~~~~~~~~~~~~~^^
  File "/Users/raffi/PycharmProjects/debug-tutorial/.venv/lib/python3.13/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/Users/raffi/PycharmProjects/debug-tutorial/.venv/lib/python3.13/site-packages/django/core/management/base.py", line 416, in run_from_argv
    self.execute(*args, **cmd_options)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/raffi/PycharmProjects/debug-tutorial/.venv/lib/python3.13/site-packages/django/core/management/base.py", line 460, in execute
    output = self.handle(*args, **options)
  File "/Users/raffi/PycharmProjects/debug-tutorial/.venv/lib/python3.13/site-packages/django/core/management/commands/shell.py", line 250, in handle
    return getattr(self, shell)(options)
           ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/Users/raffi/PycharmProjects/debug-tutorial/.venv/lib/python3.13/site-packages/django/core/management/commands/shell.py", line 70, in python
    imported_objects = self.get_namespace(**options)
  File "/Users/raffi/PycharmProjects/debug-tutorial/.venv/lib/python3.13/site-packages/django/core/management/commands/shell.py", line 153, in get_namespace
    path_imports = self.get_auto_imports()
  File "/Users/raffi/PycharmProjects/debug-tutorial/.venv/lib/python3.13/site-packages/django/core/management/commands/shell.py", line 144, in get_auto_imports
    for model in reversed(apps.get_models())
                          ~~~~~~~~~~~~~~~^^
  File "/Users/raffi/PycharmProjects/debug-tutorial/.venv/lib/python3.13/site-packages/django/apps/registry.py", line 181, in get_models
    self.check_models_ready()
    ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/Users/raffi/PycharmProjects/debug-tutorial/.venv/lib/python3.13/site-packages/django/apps/registry.py", line 143, in check_models_ready
    raise AppRegistryNotReady("Models aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.

Change History (2)

comment:1 by Sarah Boyce, 4 hours ago

Severity: NormalRelease blocker
Summary: Shell raise an AppRegistryNotReadydjango-admin shell raises AppRegistryNotReady
Triage Stage: UnreviewedAccepted

Thank you for testing!

comment:2 by Sarah Boyce, 3 hours ago

Cc: Natalia Bidart Salvo Polizzi added
Has patch: set
Owner: set to Sarah Boyce
Note: See TracTickets for help on using tickets.
Back to Top