Skip to content
Myr

Merge pull request #2359 from davidism/cli-warning

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Be smarter about adding ".cli" to reloader command

authored by David Lord · committed by GitHub · parents 63129e8, 12c45f0 · Browse files · 1 file+9 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+9 added−9 removed

  • other:+9 added−9 removed

1 file+9 added−9 removed

modified:flask/cli.py+9 added-9 removed
645 unmodified lines
646})647648649def main(as_module=False):650 this_module = __package__ + '.cli'650 args = sys.argv[1:]651652 if as_module:654 if sys.version_info >= (2, 7):655 name = 'python -m ' + this_module.rsplit('.', 1)[0]656 else:657 name = 'python -m ' + this_module653 this_module = 'flask'654659 # This module is always executed as "python -m flask.run" and as such660 # we need to ensure that we restore the actual command line so that661 # the reloader can properly operate.662 sys.argv = ['-m', this_module] + sys.argv[1:]655 if sys.version_info < (2, 7):656 this_module += '.cli'657658 name = 'python -m ' + this_module659660 # Python rewrites "python -m flask" to the path to the file in argv.661 # Restore the original command so that the reloader works.662 sys.argv = ['-m', this_module] + args663 else:664 name = None665666 cli.main(args=args, prog_name=name)
4 unmodified lines