Skip to content
Myr

Fix #2897 - Add `extra_files` option to `flask run` CLI

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

authored by Bruno Rocha · committed by David Lord · parent 4fe81d7 · Browse files · 3 files+23 added−2 removed
This commit

State

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

Diff stats

3 files+23 added−2 removed

  • other:+23 added−2 removed

3 files+23 added−2 removed

modified:docs/cli.rst+14 added
200 unmodified lines
201202These can be added to the ``.flaskenv`` file just like ``FLASK_APP`` to203control default command options.204205To define a list of files the reloader should watch additionally to the modules206as in ``extra_files`` argument used in the ``app.run`` and ``werkzeug.serving.run_simple``207you can either use the ``--extra-files`` (or multiple ``-f``) option or define the208``FLASK_RUN_EXTRA_FILES`` environment variable.209210.. code-block:: none211212 # on windows use ``;`` instead of ``:`` to separate paths213 export FLASK_RUN_EXTRA_FILES=/path/to/file1:/path/to/file2214 flask run215 * Running on http://127.0.0.1:8000/216 * Detected change in '/path/to/file1', reloading217218On command line the same can be achieved with ``flask run -f /path/to/file1 -f /path/to/file2``.219220Disable dotenv221~~~~~~~~~~~~~~222223The ``flask`` command will show a message if it detects dotenv files but
259 unmodified lines
modified:flask/cli.py+6 added-1 removed
776 unmodified lines
777 "--with-threads/--without-threads",778 default=True,779 help="Enable or disable multithreading.",780)781@click.option('--extra-files', '-f',782 multiple=True, default=None, type=click.Path(),783 help='Files reloader should watch additionally to the modules')784@pass_script_info782def run_command(info, host, port, reload, debugger, eager_loading, with_threads, cert):785def run_command(info, host, port, reload, debugger, eager_loading,786 with_threads, cert, extra_files):787 """Run a local development server.788789 This server is for development purposes only. It does not provide790 the stability, security, or performance of production WSGI servers.
24 unmodified lines
815 use_reloader=reload,816 use_debugger=debugger,817 threaded=with_threads,818 ssl_context=cert,819 extra_files=extra_files820 )821822823@click.command("shell", short_help="Run a shell in the app context.")
106 unmodified lines
modified:CHANGES.rst+3 added-1 removed
55 unmodified lines
56.. _#3059: https://github.com/pallets/flask/pull/305957.. _#3179: https://github.com/pallets/flask/pull/317958.. _#3125: https://github.com/pallets/flask/pull/31255960- Added support to ``extra_files`` argument in `flask run` CLI. (`#2898`_)6162.. _#2898: https://github.com/pallets/flask/pull/28986364Version 1.0.365-------------6667Released 2019-05-17
21 unmodified lines
89.. _#2900: https://github.com/pallets/flask/issues/290090.. _#2933: https://github.com/pallets/flask/issues/293391.. _#2986: https://github.com/pallets/flask/pull/2986929093Version 1.0.294-------------9596Released 2018-05-02
909 unmodified lines