From 24df8fc89d5659d041b91b30a2ada9de49ec2264 Mon Sep 17 00:00:00 2001 From: David Lord Date: Wed, 15 Feb 2023 14:24:56 -0800 Subject: [PATCH] show 'run --debug' in docs Reverts commit 4d69165ab6e17fa754139d348cdfd9edacbcb999. Now that a release has this option, it's ok to show it in the docs. It had been reverted because the 2.2.x docs showed it before 2.2.3 was released. --- docs/cli.rst | 12 ++++++++++-- docs/config.rst | 12 ++++++------ docs/debugging.rst | 4 ++-- docs/quickstart.rst | 2 +- docs/server.rst | 2 +- docs/tutorial/factory.rst | 2 +- examples/celery/README.md | 2 +- examples/tutorial/README.rst | 2 +- 8 files changed, 23 insertions(+), 15 deletions(-) diff --git a/docs/cli.rst b/docs/cli.rst index 22484f1731..be5a0b701b 100644 --- a/docs/cli.rst +++ b/docs/cli.rst @@ -95,7 +95,7 @@ the ``--debug`` option. .. code-block:: console - $ flask --app hello --debug run + $ flask --app hello run --debug * Serving Flask app "hello" * Debug mode: on * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) @@ -103,6 +103,14 @@ the ``--debug`` option. * Debugger is active! * Debugger PIN: 223-456-919 +The ``--debug`` option can also be passed to the top level ``flask`` command to enable +debug mode for any command. The following two ``run`` calls are equivalent. + +.. code-block:: console + + $ flask --app hello --debug run + $ flask --app hello run --debug + Watch and Ignore Files with the Reloader ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -550,7 +558,7 @@ a name such as "flask run". 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. -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. If you installed your project as a package in your virtualenv, you may uncheck the diff --git a/docs/config.rst b/docs/config.rst index 7cffc44bb2..9db2045f7a 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -47,17 +47,17 @@ Debug Mode 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 -``--debug`` option on the ``flask`` command. ``flask run`` will use the interactive -debugger and reloader by default in debug mode. +``--debug`` option on the ``flask`` or ``flask run`` command. ``flask run`` will use the +interactive debugger and reloader by default in debug mode. .. 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 -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 -a previous value. +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 a previous value. Builtin Configuration Values diff --git a/docs/debugging.rst b/docs/debugging.rst index fb3604b036..18f4286758 100644 --- a/docs/debugging.rst +++ b/docs/debugging.rst @@ -43,7 +43,7 @@ The debugger is enabled by default when the development server is run in debug m .. 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 mostly equivalent. @@ -72,7 +72,7 @@ which can interfere. .. 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: diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 02dbc97835..ad9e3bc4e8 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -108,7 +108,7 @@ To enable debug mode, use the ``--debug`` option. .. code-block:: text - $ flask --app hello --debug run + $ flask --app hello run --debug * Serving Flask app 'hello' * Debug mode: on * Running on http://127.0.0.1:5000 (Press CTRL+C to quit) diff --git a/docs/server.rst b/docs/server.rst index a34dfab5dd..d38aa12089 100644 --- a/docs/server.rst +++ b/docs/server.rst @@ -24,7 +24,7 @@ debug mode. .. 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 starts the server on http://localhost:5000/. Use ``flask run --help`` to see the diff --git a/docs/tutorial/factory.rst b/docs/tutorial/factory.rst index c8e2c5f4e0..39febd135f 100644 --- a/docs/tutorial/factory.rst +++ b/docs/tutorial/factory.rst @@ -137,7 +137,7 @@ follow the tutorial. .. code-block:: text - $ flask --app flaskr --debug run + $ flask --app flaskr run --debug You'll see output similar to this: diff --git a/examples/celery/README.md b/examples/celery/README.md index 91782019e2..038eb51eb6 100644 --- a/examples/celery/README.md +++ b/examples/celery/README.md @@ -19,7 +19,7 @@ In a separate terminal, activate the virtualenv and run the Flask development se ```shell $ . ./.venv/bin/activate -$ flask -A task_app --debug run +$ flask -A task_app run --debug ``` Go to http://localhost:5000/ and use the forms to submit tasks. You can see the polling diff --git a/examples/tutorial/README.rst b/examples/tutorial/README.rst index a7e12ca250..1c745078bc 100644 --- a/examples/tutorial/README.rst +++ b/examples/tutorial/README.rst @@ -48,7 +48,7 @@ Run .. code-block:: text $ 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.