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.
Thank you for testing!