Prefer flask run --debug in docs

This commit is contained in:
Grey Li 2022-08-23 12:44:50 +08:00 committed by David Lord
parent 4bc0e4943d
commit bd26928fdb
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
9 changed files with 15 additions and 19 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 97 KiB

Before After
Before After

View file

@ -95,7 +95,7 @@ the ``--debug`` option.
.. code-block:: console .. code-block:: console
$ flask --app hello --debug run $ flask --app hello run --debug
* Serving Flask app "hello" * Serving Flask app "hello"
* Debug mode: on * Debug mode: on
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
@ -550,7 +550,7 @@ a name such as "flask run".
Click the *Script path* dropdown and change it to *Module name*, then input ``flask``. Click the *Script path* dropdown and change it to *Module name*, then input ``flask``.
The *Parameters* field is set to the CLI command to execute along with any arguments. The *Parameters* field is set to the CLI command to execute along with any arguments.
This example uses ``--app hello --debug run``, which will run the development server in This example uses ``--app hello run --debug``, which will run the development server in
debug mode. ``--app hello`` should be the import or file with your Flask app. debug mode. ``--app hello`` should be the import or file with your Flask app.
If you installed your project as a package in your virtualenv, you may uncheck the If you installed your project as a package in your virtualenv, you may uncheck the

View file

@ -47,15 +47,15 @@ Debug Mode
The :data:`DEBUG` config value is special because it may behave inconsistently if The :data:`DEBUG` config value is special because it may behave inconsistently if
changed after the app has begun setting up. In order to set debug mode reliably, use the changed after the app has begun setting up. In order to set debug mode reliably, use the
``--debug`` option on the ``flask`` command. ``flask run`` will use the interactive ``--debug`` option on the ``flask run`` command. ``flask run`` will use the interactive
debugger and reloader by default in debug mode. debugger and reloader by default in debug mode.
.. code-block:: text .. code-block:: text
$ flask --app hello --debug run $ flask --app hello run --debug
Using the option is recommended. While it is possible to set :data:`DEBUG` in your Using the option is recommended. While it is possible to set :data:`DEBUG` in your
config or code, this is strongly discouraged. It can't be read early by the ``flask`` config or code, this is strongly discouraged. It can't be read early by the ``flask run``
command, and some systems or extensions may have already configured themselves based on command, and some systems or extensions may have already configured themselves based on
a previous value. a previous value.

View file

@ -43,7 +43,7 @@ The debugger is enabled by default when the development server is run in debug m
.. code-block:: text .. code-block:: text
$ flask --app hello --debug run $ flask --app hello run --debug
When running from Python code, passing ``debug=True`` enables debug mode, which is When running from Python code, passing ``debug=True`` enables debug mode, which is
mostly equivalent. mostly equivalent.
@ -72,7 +72,7 @@ which can interfere.
.. code-block:: text .. code-block:: text
$ flask --app hello --debug run --no-debugger --no-reload $ flask --app hello run --debug --no-debugger --no-reload
When running from Python: When running from Python:

View file

@ -108,7 +108,7 @@ To enable debug mode, use the ``--debug`` option.
.. code-block:: text .. code-block:: text
$ flask --app hello --debug run $ flask --app hello run --debug
* Serving Flask app 'hello' * Serving Flask app 'hello'
* Debug mode: on * Debug mode: on
* Running on http://127.0.0.1:5000 (Press CTRL+C to quit) * Running on http://127.0.0.1:5000 (Press CTRL+C to quit)

View file

@ -24,7 +24,7 @@ debug mode.
.. code-block:: text .. code-block:: text
$ flask --app hello --debug run $ flask --app hello run --debug
This enables debug mode, including the interactive debugger and reloader, and then This enables debug mode, including the interactive debugger and reloader, and then
starts the server on http://localhost:5000/. Use ``flask run --help`` to see the starts the server on http://localhost:5000/. Use ``flask run --help`` to see the

View file

@ -137,7 +137,7 @@ follow the tutorial.
.. code-block:: text .. code-block:: text
$ flask --app flaskr --debug run $ flask --app flaskr run --debug
You'll see output similar to this: You'll see output similar to this:

View file

@ -48,7 +48,7 @@ Run
.. code-block:: text .. code-block:: text
$ flask --app flaskr init-db $ flask --app flaskr init-db
$ flask --app flaskr --debug run $ flask --app flaskr run --debug
Open http://127.0.0.1:5000 in a browser. Open http://127.0.0.1:5000 in a browser.

View file

@ -837,11 +837,6 @@ class SeparatedPathType(click.Path):
expose_value=False, expose_value=False,
help="The key file to use when specifying a certificate.", 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( @click.option(
"--reload/--no-reload", "--reload/--no-reload",
default=None, default=None,
@ -883,7 +878,6 @@ def run_command(
info, info,
host, host,
port, port,
debug,
reload, reload,
debugger, debugger,
with_threads, with_threads,
@ -916,8 +910,7 @@ def run_command(
# command fails. # command fails.
raise e from None raise e from None
if debug is None: debug = get_debug_flag()
debug = get_debug_flag()
if reload is None: if reload is None:
reload = debug reload = debug
@ -940,6 +933,9 @@ def run_command(
) )
run_command.params.insert(0, _debug_option)
@click.command("shell", short_help="Run a shell in the app context.") @click.command("shell", short_help="Run a shell in the app context.")
@with_appcontext @with_appcontext
def shell_command() -> None: def shell_command() -> None: