diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py index 5687cb2bc07..373f9e927e2 100644 --- a/django/core/management/__init__.py +++ b/django/core/management/__init__.py @@ -249,6 +249,15 @@ class ManagementUtility(object): usage.append(style.NOTICE("[%s]" % app)) for name in sorted(commands_dict[app]): usage.append(" %s" % name) + # Output an extra note if settings are not properly configured + try: + from django.conf import settings + settings.INSTALLED_APPS + except ImproperlyConfigured as e: + usage.append(style.NOTICE( + "Note that only Django core commands are listed as settings " + "are not properly configured (error: %s)." % e)) + return '\n'.join(usage) def fetch_command(self, subcommand): diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py index e5d2acd3a53..7837a60003d 100644 --- a/tests/admin_scripts/tests.py +++ b/tests/admin_scripts/tests.py @@ -1055,6 +1055,17 @@ class ManageSettingsWithSettingsErrors(AdminScriptTestCase): self.assertNoOutput(out) self.assertOutput(err, "KeyError: 'blah'") + def test_help(self): + """ + Test listing available commands output note when only core commands are + available. + """ + self.write_settings('settings.py', sdict={'MEDIA_URL': '"/no_ending_slash"'}) + args = ['help'] + out, err = self.run_manage(args) + self.assertOutput(out, 'only Django core commands are listed') + self.assertNoOutput(err) + class ManageValidate(AdminScriptTestCase): def tearDown(self):