diff --git a/uvicorn/supervisors/watchfilesreload.py b/uvicorn/supervisors/watchfilesreload.py index 186368312..1c11169dc 100644 --- a/uvicorn/supervisors/watchfilesreload.py +++ b/uvicorn/supervisors/watchfilesreload.py @@ -68,7 +68,7 @@ def __init__( for directory in config.reload_dirs: if Path.cwd() not in directory.parents: self.reload_dirs.append(directory) - if Path.cwd() not in self.reload_dirs: + if (len(self.reload_dirs) == 0) and (Path.cwd() not in self.reload_dirs): self.reload_dirs.append(Path.cwd()) self.watch_filter = FileFilter(config) diff --git a/uvicorn/supervisors/watchgodreload.py b/uvicorn/supervisors/watchgodreload.py index d8bceacef..648a5b9c8 100644 --- a/uvicorn/supervisors/watchgodreload.py +++ b/uvicorn/supervisors/watchgodreload.py @@ -142,7 +142,7 @@ def __init__( for directory in config.reload_dirs: if Path.cwd() not in directory.parents: reload_dirs.append(directory) - if Path.cwd() not in reload_dirs: + if (len(reload_dirs) == 0) and (Path.cwd() not in reload_dirs): reload_dirs.append(Path.cwd()) for w in reload_dirs: self.watchers.append(CustomWatcher(w.resolve(), self.config))