starlette icon indicating copy to clipboard operation
starlette copied to clipboard

StaticFiles always checks package directories

Open Kludex opened this issue 3 years ago • 0 comments

Discussed in https://github.com/encode/starlette/discussions/1821

Originally posted by falkben August 26, 2022 StaticFiles always checks for the existence of package directories, regardless of whether check_dir is set to True or False.

as an example, this raises an exception:

app = StaticFiles(packages=[("tests", "no_such_directory")], check_dir=False)

Whereas I would have expected it to be able to be create the app instance without errors when check_dir is set to False.

Before I create an Issue or submit a Pull Request, I just wanted to confirm whether this was something that was intended or not.

It looks like the check_dir flag was added several years ago but was not included when support for packages were added to StaticFiles

Kludex avatar Aug 26 '22 05:08 Kludex