Added support for a FLASK_RUN_EXTRA_FILES config variable.

Similar to the `flask run --extra_files=..` CLI argument or the `FLASK_RUN_EXTRA_FILES` environment variable, this is another method to specify other files to watch.
This commit is contained in:
Grayden 2021-08-05 15:46:09 -04:00
parent 0826be48ed
commit 7daf197dd6
3 changed files with 19 additions and 0 deletions

View file

@ -184,12 +184,16 @@ reloader.
Watch Extra Files with the Reloader
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. versionadded:: 2.1
Support for the ``FLASK_RUN_EXTRA_FILES`` config variable was added.
When using development mode, the reloader will trigger whenever your
Python code or imported modules change. The reloader can watch
additional files with the ``--extra-files`` option, or the
``FLASK_RUN_EXTRA_FILES`` environment variable. Multiple paths are
separated with ``:``, or ``;`` on Windows.
.. tabs::
.. group-tab:: Bash
@ -226,6 +230,15 @@ separated with ``:``, or ``;`` on Windows.
* Detected change in '/path/to/file1', reloading
Alternatively, you can set the ``FLASK_RUN_EXTRA_FILES`` config
variable, which takes a list of files::
from flask import Flask
app = Flask(__name__)
app.config['FLASK_RUN_EXTRA_FILES'] = ["file1", "dirA/file2", "dirB/"]
Debug Mode
----------