#25555: Django swallows exceptions when running management commands
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core | Version: 1.8
(Management commands) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
With Django 1.8.5 and after following steps in a fresh project:
1. Add settings.LOGGING = {'invalid'}
2. python manage.py runserver
You'll get an exception mentioning that apps aren't ready yet. If you call
django.setup() in a manual script you'll get a nice exception by which it
is possible to see that your logging config is invalid.
The problem lies somewhere in the management command setup, or in the way
get_app_configs() reports errors.
Stacktrace:
{{{
(tehku2_env)securejava@debian:~/projects/testapp$ python manage.py
runserver
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/securejava/projects/tehku2_env/lib/python3.4/site-
packages/django/core/management/__init__.py", line 351, in
execute_from_command_line
utility.execute()
File "/home/securejava/projects/tehku2_env/lib/python3.4/site-
packages/django/core/management/__init__.py", line 343, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/securejava/projects/tehku2_env/lib/python3.4/site-
packages/django/core/management/__init__.py", line 177, in fetch_command
commands = get_commands()
File "/home/securejava/projects/tehku2_env/lib/python3.4/functools.py",
line 434, in wrapper
result = user_function(*args, **kwds)
File "/home/securejava/projects/tehku2_env/lib/python3.4/site-
packages/django/core/management/__init__.py", line 72, in get_commands
for app_config in reversed(list(apps.get_app_configs())):
File "/home/securejava/projects/tehku2_env/lib/python3.4/site-
packages/django/apps/registry.py", line 137, in get_app_configs
self.check_apps_ready()
File "/home/securejava/projects/tehku2_env/lib/python3.4/site-
packages/django/apps/registry.py", line 124, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
}}}
Interestingly if you run instead manage.py --version, the exception isn't
swallowed.
--
Ticket URL: <https://code.djangoproject.com/ticket/25555>
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/051.83902ba78cc5e59cb56306fbe51c496f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.