Examples of serving static files

The quixote.util module includes classes for making files and directories available as Quixote resources. Here are some examples.

A single file

Map an individual filesystem file (possibly a symbolic link). Because 'stylesheet.css' isn't a valid identifier name, we need to use setattr to set it as an attribute of the current module.):

this_module = sys.modules[__name__]
setattr(
    this_module, 
    "stylesheet.css", 
    StaticFile(
        "/htdocs/legacy_app/stylesheet.css",
        follow_symlinks=1
    )
)

A directory

Map a complete filesystem directory containing static files, not caching the contents.

::

notes = StaticDirectory("/htdocs/legacy_app/notes")