#22066: KeyError in settings.py leads to baffling 'Unknown command' error --------------------------------------------+-------------------- Reporter: michael.karl.coleman@… | Owner: nobody Type: Bug | Status: new Component: Core (Management commands) | Version: 1.6 Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 1 | UI/UX: 0 --------------------------------------------+-------------------- In two places in core/management/__init__.py, there is code like this {{{ try: app_name = get_commands()[name] except KeyError: raise CommandError("Unknown command: %r" % name) }}} Unfortunately, KeyErrors from settings.py seem to get caught here, leading to a baffling error message. The fix would be to just do something like {{{ commands = get_commands() if name not in commands: raise CommandError("Unknown command: %r" % name) app_name = name }}} and let any KeyError from settings.py escape as a backtrace, so that the user can see and fix it directly.
Unfortunately, I don't have time to recreate this and verify that it still exists in HEAD, but just looking at the code, I think it probably does. This is related to #19257, but I don't believe it's the same bug. -- Ticket URL: <https://code.djangoproject.com/ticket/22066> 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/073.d17f9600e88b2d662d5d16381e3769b3%40djangoproject.com. For more options, visit https://groups.google.com/groups/opt_out.