Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
May 24, 2019

Conversation

rochacbruno
Copy link
Contributor

@rochacbruno rochacbruno commented Aug 31, 2018

Fix #2897

To define a list of files the reloader should watch additionally to the modules
as in extra_files argument used in the app.run and werkzeug.serving.run_simple
you can either use the --extra-files (or multiple -f) option or define the
FLASK_RUN_EXTRA_FILES environment variable.

    # on windows use ``;`` instead of ``:`` to separate paths
    export FLASK_RUN_EXTRA_FILES=/path/to/file1:/path/to/file2
    flask run
     * Running on http://127.0.0.1:8000/
     * Detected change in '/path/to/file1', reloading

On command line the same can be achieved with flask run -f /path/to/file1 -f /path/to/file2.

@rochacbruno rochacbruno force-pushed the 2897-Add-Extra-Files-to-CLI branch 2 times, most recently from 9228dc4 to 5d92197 Compare August 31, 2018 22:16
@rochacbruno
Copy link
Contributor Author

rochacbruno commented Aug 31, 2018

The travis error

Traceback (most recent call last):
  File "/home/travis/build/pallets/flask/.tox/docs-html/lib/python3.6/site-packages/sphinx/config.py", line 161, in __init__
    execfile_(filename, config)
  File "/home/travis/build/pallets/flask/.tox/docs-html/lib/python3.6/site-packages/sphinx/util/pycompat.py", line 150, in execfile_
    exec_(code, _globals)
  File "conf.py", line 7, in <module>
    from pallets_sphinx_themes import DocVersion, ProjectLink, get_version
ImportError: cannot import name 'DocVersion'

ERROR: InvocationError for command '/home/travis/build/pallets/flask/.tox/docs-html/bin/sphinx-build -W -b html -d /home/travis/build/pallets/flask/.tox/docs-html/tmp/doctrees docs /home/travis/build/pallets/flask/.tox/docs-html/tmp/html' (exited with code 2)

Is also happening locally, all other envs of the tox matrix is passing except the docs. looks like recent changes to DocVersion location on pallets_sphinx_themes @davidism

@ultimatecoder

This comment has been minimized.

@onovy
Copy link
Contributor

onovy commented Sep 18, 2018

please rebase on master, DocVersion import is already fixed

@rochacbruno
Copy link
Contributor Author

@onovy done!

@davidism
Copy link
Member

Current failures are due to Werkzeug master, don't worry about it.

@rochacbruno
Copy link
Contributor Author

Do you still want this to be merged? should I rebase or close it?

@davidism
Copy link
Member

currently working on Werkzeug

@davidism
Copy link
Member

davidism commented May 24, 2019

--extra-files implies that one option takes multiple values, when it really becomes --extra-files file1 --extra-files file2. Does --extra-file make sense instead? What about making a type that matches the behavior of the env var, so it really is just a single option separate by :? Also, except for -h and -p, no options have a short form.

Multiple paths for the reloader's `--extra-files` are accepted as one
option, separated by ':'.
@davidism davidism force-pushed the 2897-Add-Extra-Files-to-CLI branch from 7c40aeb to e18cc4d Compare May 24, 2019 14:22
@davidism
Copy link
Member

Pushed a new version that adds a SeparatedPathType that allows --extra-files to be a single option that behaves like the env var. Removed the -f short option. Moved the docs to the section about development mode, since that's where the reloader is most relevant, although it might be good to reorganize / break up the CLI docs eventually.

@davidism davidism added this to the 1.1.0 milestone May 24, 2019
@davidism davidism added the cli label May 24, 2019
@davidism davidism merged commit 2616d97 into pallets:master May 24, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Define reloader extra_files in flask run CLI
5 participants