(
self,
*,
directory: str | os.PathLike[str],
fallback: Literal["auto", "index.html", "404.html"] | None,
check_dir: bool = True,
)
| 1853 | |
| 1854 | class _FrontendStaticFiles(StaticFiles): |
| 1855 | def __init__( |
| 1856 | self, |
| 1857 | *, |
| 1858 | directory: str | os.PathLike[str], |
| 1859 | fallback: Literal["auto", "index.html", "404.html"] | None, |
| 1860 | check_dir: bool = True, |
| 1861 | ) -> None: |
| 1862 | self.fallback = fallback |
| 1863 | if check_dir and not os.path.isdir(directory): |
| 1864 | raise RuntimeError( |
| 1865 | f"Frontend directory '{directory}' does not exist. " |
| 1866 | f"Resolved absolute path: '{_get_resolved_absolute_path(directory)}'" |
| 1867 | ) |
| 1868 | super().__init__( |
| 1869 | directory=directory, |
| 1870 | html=True, |
| 1871 | check_dir=check_dir, |
| 1872 | follow_symlink=False, |
| 1873 | ) |
| 1874 | if check_dir and fallback in {"index.html", "404.html"}: |
| 1875 | self._check_fallback_file(fallback) |
| 1876 | |
| 1877 | def _check_fallback_file(self, fallback: str) -> None: |
| 1878 | _, stat_result = self.lookup_path(fallback) |
nothing calls this directly
no test coverage detected