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
Provenance
- Commit
bd26928- Tree
5f153e8- Author
Grey Li <withlihui@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent
4bc0e49
9 files changed+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 lines136 follow the tutorial.137 138 .. code-block:: text139 140- $ flask --app flaskr --debug run140+ $ flask --app flaskr run --debug141 142 You'll see output similar to this:143 144 .. code-block:: text18 unmodified linesmodified:docs/cli.rst+2 added-2 removed
93 unmodified lines94 the ``--debug`` option.95 96 .. code-block:: console97 98- $ 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 reloader446 unmodified lines549 550 Click the *Script path* dropdown and change it to *Module name*, then input ``flask``.551 552 The *Parameters* field is set to the CLI command to execute along with any arguments.553-This example uses ``--app hello --debug run``, which will run the development server in553+This example uses ``--app hello run --debug``, which will run the development server in554 debug mode. ``--app hello`` should be the import or file with your Flask app.555 556 If 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 linesmodified:docs/config.rst+3 added-3 removed
45 unmodified lines46 ----------47 48 The :data:`DEBUG` config value is special because it may behave inconsistently if49 changed 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 interactive51 debugger and reloader by default in debug mode.52 53 .. code-block:: text54 55- $ flask --app hello --debug run55+ $ flask --app hello run --debug56 57 Using the option is recommended. While it is possible to set :data:`DEBUG` in your58-config or code, this is strongly discouraged. It can't be read early by the ``flask``58+config or code, this is strongly discouraged. It can't be read early by the ``flask run``59 command, and some systems or extensions may have already configured themselves based on60 a previous value.61 62 718 unmodified linesmodified:docs/debugging.rst+2 added-2 removed
41 unmodified lines42 The debugger is enabled by default when the development server is run in debug mode.43 44 .. code-block:: text45 46- $ flask --app hello --debug run46+ $ flask --app hello run --debug47 48 When running from Python code, passing ``debug=True`` enables debug mode, which is49 mostly equivalent.50 20 unmodified lines71 which can interfere.72 73 .. code-block:: text74 75- $ flask --app hello --debug run --no-debugger --no-reload75+ $ flask --app hello run --debug --no-debugger --no-reload76 77 When running from Python:78 79 .. code-block:: python8 unmodified linesmodified:docs/quickstart.rst+1 added-1 removed
106 unmodified lines107 To enable debug mode, use the ``--debug`` option.108 109 .. code-block:: text110 111- $ 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 stat792 unmodified linesmodified:docs/server.rst+1 added-1 removed
22 unmodified lines23 debug mode.24 25 .. code-block:: text26 27- $ flask --app hello --debug run27+ $ flask --app hello run --debug28 29 This enables debug mode, including the interactive debugger and reloader, and then30 starts the server on http://localhost:5000/. Use ``flask run --help`` to see the31 available options, and :doc:`/cli` for detailed instructions about configuring and using84 unmodified linesmodified:examples/tutorial/README.rst+1 added-1 removed
46 unmodified lines47 48 .. code-block:: text49 50 $ flask --app flaskr init-db51- $ flask --app flaskr --debug run51+ $ flask --app flaskr run --debug52 53 Open http://127.0.0.1:5000 in a browser.54 55 13 unmodified linesmodified:src/flask/cli.py+4 added-8 removed
836 unmodified lines837 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 lines877 def run_command(878 info,879 host,880 port,886- debug,881 reload,882 debugger,883 with_threads,884 cert,24 unmodified lines909 # When not reloading, raise the error immediately so the910 # command fails.911 raise e from None912 919- if debug is None:920- debug = get_debug_flag()913+ debug = get_debug_flag()914 915 if reload is None:916 reload = debug917 14 unmodified lines932 exclude_patterns=exclude_patterns,933 )934 935 936+run_command.params.insert(0, _debug_option)937+938+939 @click.command("shell", short_help="Run a shell in the app context.")940 @with_appcontext941 def shell_command() -> None:942 """Run an interactive Python shell in the context of a given112 unmodified lines