Warning: Bocadillo is now UNMAINTAINED. Users are recommended to migrate to a supported alternative, such as Starlette or FastAPI. Please see #344 for more information.

bocadillo.staticfiles

static

static(root:str, **kwargs) -> Callable[[dict, Callable[[str, List[str]], NoneType]], List[bytes]]

Return a WSGI app that serves static files under the given directory.

Powered by WhiteNoise.

Parameters

  • root (str): the path to a directory from where static files should be served. If the directory does not exist, no files will be served.
  • **kwargs (any): keyword arguments passed to the WhiteNoise constructor. See also Configuration attributes (WhiteNoise docs).

Returns

app (callable): a WhiteNoise WSGI app.