summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-rw-r--r--django/core/management/__init__.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py
index eac95e6b37..19aaa4aedc 100644
--- a/django/core/management/__init__.py
+++ b/django/core/management/__init__.py
@@ -257,8 +257,10 @@ class ManagementUtility(object):
appropriate command called from the command line (usually
"django-admin.py" or "manage.py") if it can't be found.
"""
+ # Get commands outside of try block to prevent swallowing exceptions
+ commands = get_commands()
try:
- app_name = get_commands()[subcommand]
+ app_name = commands[subcommand]
except KeyError:
sys.stderr.write("Unknown command: %r\nType '%s help' for usage.\n" % \
(subcommand, self.prog_name))