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

add note in Settings on using WatchFiles on WSL #1647

Merged
merged 5 commits into from Sep 14, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/settings.md
Expand Up @@ -38,8 +38,11 @@ If Uvicorn _cannot_ load [watchfiles](https://pypi.org/project/watchfiles/) at r

### Reloading with watchfiles

For more nuanced control over which file modifications trigger reloads, install `uvicorn[standard]`, which includes watchfiles as a dependency. Alternatively, install [watchfiles](https://pypi.org/project/watchfiles/) where Uvicorn can see it. This will enable the following options (which are otherwise ignored).
For more nuanced control over which file modifications trigger reloads, install `uvicorn[standard]`, which includes watchfiles as a dependency. Alternatively, install [watchfiles](https://pypi.org/project/watchfiles/) where Uvicorn can see it.

Note that if you use Uvicorn through [WSL](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux), for example when running a Docker container on Windows, you might have to set the environment variable `WATCHFILES_FORCE_POLLING`, for file changes to trigger a reload. See [watchfiles documentation](https://watchfiles.helpmanual.io/api/watch/) for further details.

Using Uvicorn with watchfiles will enable the following options (which are otherwise ignored).
Kludex marked this conversation as resolved.
Show resolved Hide resolved
* `--reload-include <glob-pattern>` - Specify a glob pattern to match files or directories which will be watched. May be used multiple times. By default the following patterns are included: `*.py`. These defaults can be overwritten by including them in `--reload-exclude`.
* `--reload-exclude <glob-pattern>` - Specify a glob pattern to match files or directories which will excluded from watching. May be used multiple times. By default the following patterns are excluded: `.*, .py[cod], .sw.*, ~*`. These defaults can be overwritten by including them in `--reload-include`.

Expand Down