Skip to content
Myr

Prefer flask run --debug in docs

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

authored by Grey Li · committed by David Lord · parent 4bc0e49 · Browse files · 9 files+15 added−19 removed
This commit

State

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

Diff stats

9 files+15 added−19 removed

  • other:+15 added−19 removed

9 files+15 added−19 removed

modified:docs/_static/pycharm-run-config.pngbinary

A binary file, modified.

modified:docs/tutorial/factory.rst+1 added-1 removed
135 unmodified lines
136follow the tutorial.137138.. code-block:: text139140 $ flask --app flaskr --debug run140 $ flask --app flaskr run --debug141142You'll see output similar to this:143144.. code-block:: text
18 unmodified lines
modified:docs/cli.rst+2 added-2 removed
93 unmodified lines
94the ``--debug`` option.9596.. code-block:: console9798 $ flask --app hello --debug run98 $ flask --app hello run --debug99 * Serving Flask app "hello"100 * Debug mode: on101 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)102 * Restarting with inotify reloader
446 unmodified lines
549550Click the *Script path* dropdown and change it to *Module name*, then input ``flask``.551552The *Parameters* field is set to the CLI command to execute along with any arguments.553This example uses ``--app hello --debug run``, which will run the development server in553This example uses ``--app hello run --debug``, which will run the development server in554debug mode. ``--app hello`` should be the import or file with your Flask app.555556If you installed your project as a package in your virtualenv, you may uncheck the557*PYTHONPATH* options. This will more accurately match how you deploy later.
6 unmodified lines
modified:docs/config.rst+3 added-3 removed
45 unmodified lines
46----------4748The :data:`DEBUG` config value is special because it may behave inconsistently if49changed after the app has begun setting up. In order to set debug mode reliably, use the50``--debug`` option on the ``flask`` command. ``flask run`` will use the interactive50``--debug`` option on the ``flask run`` command. ``flask run`` will use the interactive51debugger and reloader by default in debug mode.5253.. code-block:: text5455 $ flask --app hello --debug run55 $ flask --app hello run --debug5657Using the option is recommended. While it is possible to set :data:`DEBUG` in your58config or code, this is strongly discouraged. It can't be read early by the ``flask``58config or code, this is strongly discouraged. It can't be read early by the ``flask run``59command, and some systems or extensions may have already configured themselves based on60a previous value.6162
718 unmodified lines
modified:docs/debugging.rst+2 added-2 removed
41 unmodified lines
42The debugger is enabled by default when the development server is run in debug mode.4344.. code-block:: text4546 $ flask --app hello --debug run46 $ flask --app hello run --debug4748When running from Python code, passing ``debug=True`` enables debug mode, which is49mostly equivalent.50
20 unmodified lines
71which can interfere.7273.. code-block:: text7475 $ flask --app hello --debug run --no-debugger --no-reload75 $ flask --app hello run --debug --no-debugger --no-reload7677When running from Python:7879.. code-block:: python
8 unmodified lines
modified:docs/quickstart.rst+1 added-1 removed
106 unmodified lines
107To enable debug mode, use the ``--debug`` option.108109.. code-block:: text110111 $ flask --app hello --debug run111 $ flask --app hello run --debug112 * Serving Flask app 'hello'113 * Debug mode: on114 * Running on http://127.0.0.1:5000 (Press CTRL+C to quit)115 * Restarting with stat
792 unmodified lines
modified:docs/server.rst+1 added-1 removed
22 unmodified lines
23debug mode.2425.. code-block:: text2627 $ flask --app hello --debug run27 $ flask --app hello run --debug2829This enables debug mode, including the interactive debugger and reloader, and then30starts the server on http://localhost:5000/. Use ``flask run --help`` to see the31available options, and :doc:`/cli` for detailed instructions about configuring and using
84 unmodified lines
modified:examples/tutorial/README.rst+1 added-1 removed
46 unmodified lines
4748.. code-block:: text4950 $ flask --app flaskr init-db51 $ flask --app flaskr --debug run51 $ flask --app flaskr run --debug5253Open http://127.0.0.1:5000 in a browser.5455
13 unmodified lines
modified:src/flask/cli.py+4 added-8 removed
836 unmodified lines
837 expose_value=False,838 help="The key file to use when specifying a certificate.",839)840@click.option(841 "--debug/--no-debug",842 default=None,843 help="Enable or disable the debug mode.",844)845@click.option(841 "--reload/--no-reload",842 default=None,843 help="Enable or disable the reloader. By default the reloader "844 "is active if debug is enabled.",
32 unmodified lines
877def run_command(878 info,879 host,880 port,886 debug,881 reload,882 debugger,883 with_threads,884 cert,
24 unmodified lines
909 # When not reloading, raise the error immediately so the910 # command fails.911 raise e from None912919 if debug is None:920 debug = get_debug_flag()913 debug = get_debug_flag()914915 if reload is None:916 reload = debug917
14 unmodified lines
932 exclude_patterns=exclude_patterns,933 )934935936run_command.params.insert(0, _debug_option)937938939@click.command("shell", short_help="Run a shell in the app context.")940@with_appcontext941def shell_command() -> None:942 """Run an interactive Python shell in the context of a given
112 unmodified lines