Add --debug option to flask run

This commit is contained in:
Grey Li 2022-08-21 17:36:30 +08:00 committed by David Lord
parent 79032ca5f1
commit 4bc0e4943d
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
2 changed files with 9 additions and 1 deletions

View file

@ -7,6 +7,7 @@ Unreleased
templates this behavior can be changed with the ``autoescape`` tag.
:issue:`4831`
- Fix the type of ``template_folder`` to accept ``pathlib.Path``. :issue:`4892`
- Add ``--debug`` option to the ``flask run`` command. :issue:`4777`
Version 2.2.2

View file

@ -837,6 +837,11 @@ class SeparatedPathType(click.Path):
expose_value=False,
help="The key file to use when specifying a certificate.",
)
@click.option(
"--debug/--no-debug",
default=None,
help="Enable or disable the debug mode.",
)
@click.option(
"--reload/--no-reload",
default=None,
@ -878,6 +883,7 @@ def run_command(
info,
host,
port,
debug,
reload,
debugger,
with_threads,
@ -910,7 +916,8 @@ def run_command(
# command fails.
raise e from None
debug = get_debug_flag()
if debug is None:
debug = get_debug_flag()
if reload is None:
reload = debug