Support --ignore or --reload-file option
See original GitHub issueIs your feature related to a problem? Please describe.
My application’s file structure is as follows:
cloud-app git:(dev) ✗ tree -L 1
.
├── Dockerfile
├── README.md
├── frontend
├── gatekeeper
├── iam
├── main.py
├── manage.py
├── requirements.txt
├── templates
└── util.py
frontend
is a React SPA, gatekeeper
and iam
belong to a Django application that we mount as an ASGI sub-application alongside our fastapi ASGI app which is defined in main.py
.
Currently I run uvicorn as follow:
uvicorn main:app --reload --host 0.0.0.0 --port 8000 --reload-dir iam --reload-dir gatekeeper
I would like to see one of the following (or both!) flags supported:
--ignore-dir frontend
: would enable me to ignore changes to frontend source code that are triggering a large number of reloads of my uvicorn app, despite those changes being irrelevant;--reload-file main.py
: would enable me to whitelist specific files to watch.
I believe WatchDog can be configured to ignore/exclude files and dirs based on pattern matching.
Refs
https://pythonhosted.org/watchdog/api.html#watchdog.events.RegexMatchingEventHandler.ignore_regexes https://pythonhosted.org/watchdog/api.html#watchdog.events.PatternMatchingEventHandler.ignore_patterns
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Ignore All when unsaved changes and file changed on disk is ...
In a previous version, I'm pretty sure it just gave me the option to Reload or Ignore for each individual file. This was...
Read more >Developers - Support --ignore or --reload-file option -
Support --ignore or --reload-file option.
Read more >VS2008: Disable asking whether to reload files changed ...
For VS2008: Tools > Options > Documents > Detect when a file is changed outside the environment. For VS2010/2012/2013/2015: Tools > Options >...
Read more >How to Enable Silent Reloading in TexStudio? - TeX
Reloading overwrites the editor content with the file from disk. This cannot be undone. You can permanently enable silent reloading in the ...
Read more >Reopen documents on Reload after file modification detected
Tools > Options > Environment > Documents > Detect when file is changed outside the environment > Reload modified files unless there are...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For anyone looking to monkey patch uvicorn with watchgod for the moment, you can do something like this: https://github.com/pydanny/cookiecutter-django/pull/3168
Although that’s only dirs only, there’s also a
ignored_file_regexes
tuple-typed attribute that you can use as well since uvicorn uses DefaultWatcher.Vote for #820
And it would be great if
uvicorn.supervisors.watchgodreload.DefaultWatcher.ignored_file_regexes
had image, video and log files in it. Cause it’s expected behavior for servers to save uploaded files in app folder