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
Provenance
- Commit
2308cba- Tree
8180a83- Author
Bruno Rocha <rochacbruno@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent
4fe81d7
3 files changed+23 added−2 removed
modified:docs/cli.rst+14 added
200 unmodified lines201 202 These can be added to the ``.flaskenv`` file just like ``FLASK_APP`` to203 control default command options.204 205+To define a list of files the reloader should watch additionally to the modules206+as in ``extra_files`` argument used in the ``app.run`` and ``werkzeug.serving.run_simple``207+you can either use the ``--extra-files`` (or multiple ``-f``) option or define the208+``FLASK_RUN_EXTRA_FILES`` environment variable.209 210+.. code-block:: none211+212+ # 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', reloading217+218+On command line the same can be achieved with ``flask run -f /path/to/file1 -f /path/to/file2``.219+220 Disable dotenv221 ~~~~~~~~~~~~~~222 223 The ``flask`` command will show a message if it detects dotenv files but259 unmodified linesmodified:flask/cli.py+6 added-1 removed
776 unmodified lines777 "--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_info782-def run_command(info, host, port, reload, debugger, eager_loading, with_threads, cert):785+def run_command(info, host, port, reload, debugger, eager_loading,786+ with_threads, cert, extra_files):787 """Run a local development server.788 789 This server is for development purposes only. It does not provide790 the stability, security, or performance of production WSGI servers.24 unmodified lines815 use_reloader=reload,816 use_debugger=debugger,817 threaded=with_threads,818 ssl_context=cert,819+ extra_files=extra_files820 )821 822 823 @click.command("shell", short_help="Run a shell in the app context.")106 unmodified linesmodified:CHANGES.rst+3 added-1 removed
55 unmodified lines56 .. _#3059: https://github.com/pallets/flask/pull/305957 .. _#3179: https://github.com/pallets/flask/pull/317958 .. _#3125: https://github.com/pallets/flask/pull/312559 60+- Added support to ``extra_files`` argument in `flask run` CLI. (`#2898`_)61 62+.. _#2898: https://github.com/pallets/flask/pull/289863+64 Version 1.0.365 -------------66 67 Released 2019-05-1721 unmodified lines89 .. _#2900: https://github.com/pallets/flask/issues/290090 .. _#2933: https://github.com/pallets/flask/issues/293391 .. _#2986: https://github.com/pallets/flask/pull/298692 90-93 Version 1.0.294 -------------95 96 Released 2018-05-02909 unmodified lines