0
0
mirror of https://github.com/django/django.git synced 2024-11-29 22:56:46 +01:00

Fixed #28524 -- Fixed program name in management commands when using 'python -m django'.

This commit is contained in:
Nick Pope 2017-08-31 14:22:25 +01:00 committed by Tim Graham
parent f0d9ede9e6
commit ec6481246a
2 changed files with 6 additions and 0 deletions

View File

@ -149,6 +149,8 @@ class ManagementUtility:
def __init__(self, argv=None):
self.argv = argv or sys.argv[:]
self.prog_name = os.path.basename(self.argv[0])
if self.prog_name == '__main__.py':
self.prog_name = 'python -m django'
self.settings_exception = None
def main_help_text(self, commands_only=False):

View File

@ -2223,3 +2223,7 @@ class MainModule(AdminScriptTestCase):
cmd_out, _ = self.run_django_admin(['--version'])
mod_out, _ = self.run_test('-m', ['django', '--version'])
self.assertEqual(mod_out, cmd_out)
def test_program_name_in_help(self):
out, err = self.run_test('-m', ['django', 'help'])
self.assertOutput(out, "Type 'python -m django help <subcommand>' for help on a specific subcommand.")