Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#21737 closed Cleanup/optimization (fixed)

ImproperlyConfigured hidden, which causes hard to debug errors

Reported by: Florian Apolloner Owned by: nobody
Component: Uncategorized Version: dev
Severity: Release blocker Keywords: app-loading
Cc: Aymeric Augustin Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Putting an AppConfig without a name attribute into INSTALLED_APPS raises this nice error:

Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/florian/sources/django.git/django/core/management/__init__.py", line 426, in execute_from_command_line
    utility.execute()
  File "/home/florian/sources/django.git/django/core/management/__init__.py", line 418, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/florian/sources/django.git/django/core/management/__init__.py", line 280, in fetch_command
    commands = get_commands()
  File "/home/florian/.virtualenvs/conticki/lib/python3.4/functools.py", line 427, in wrapper
    result = user_function(*args, **kwds)
  File "/home/florian/sources/django.git/django/core/management/__init__.py", line 118, in get_commands
    app_configs = apps.get_app_configs()
  File "/home/florian/sources/django.git/django/apps/registry.py", line 121, in get_app_configs
    self.check_ready()
  File "/home/florian/sources/django.git/django/apps/registry.py", line 115, in check_ready
    raise RuntimeError("App registry isn't ready yet.")
RuntimeError: App registry isn't ready yet.

This is due to the fact that d.c.management ignores ImproperlyConfigured from django.setup

Attachments (1)

21737-1.diff (793 bytes ) - added by Claude Paroz 11 years ago.
Possible fix

Download all attachments as: .zip

Change History (6)

comment:1 by Simon Charette, 11 years ago

Keywords: app-loading added
Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

by Claude Paroz, 11 years ago

Attachment: 21737-1.diff added

Possible fix

comment:2 by Claude Paroz, 11 years ago

Has patch: set
Needs tests: set

comment:3 by Aymeric Augustin <aymeric.augustin@…>, 11 years ago

Resolution: fixed
Status: newclosed

In 2dcde523abe6dca42d9b2d46a47c402979974c77:

Avoided catching ImproperlyConfigured on django.setup().

Fixed #21737. Thanks Florian for the report.

Also removed redundant imports in that file.

comment:4 by Aymeric Augustin, 11 years ago

Oops - we worked on the same ticket at the same time.

But we came up with pretty much the same solution.

comment:5 by Claude Paroz, 11 years ago

Thanks, your solution is more elegant.

Note: See TracTickets for help on using tickets.
Back to Top