/usr/share/doc/quixote1-doc/static-files.txt is in quixote1-doc 1.2-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | Examples of serving static files
================================
The ``quixote.util`` module includes classes for making files and
directories available as Quixote resources. Here are some examples.
Publishing a Single File
------------------------
The ``StaticFile`` class makes an individual filesystem file (possibly
a symbolic link) available. You can also specify the MIME type and
encoding of the file; if you don't specify this, the MIME type will be
guessed using the standard Python ``mimetypes.guess_type()`` function.
The default action is to not follow symbolic links, but this behaviour
can be changed using the ``follow_symlinks`` parameter.
The following example publishes a file with the URL ``.../stylesheet_css``::
# 'stylesheet_css' must be in the _q_exports list
_q_exports = [ ..., 'stylesheet_css', ...]
stylesheet_css = StaticFile(
"/htdocs/legacy_app/stylesheet.css",
follow_symlinks=1, mime_type="text/css")
If you want the URL of the file to have a ``.css`` extension, you use
the external to internal name mapping feature of ``_q_exports``. For
example::
_q_exports = [ ..., ('stylesheet.css', 'stylesheet_css'), ...]
Publishing a Directory
----------------------
Publishing a directory is similar. The ``StaticDirectory`` class
makes a complete filesystem directory available. Again, the default
behaviour is to not follow symlinks. You can also request that the
``StaticDirectory`` object cache information about the files in
memory so that it doesn't try to guess the MIME type on every hit.
This example publishes the ``notes/`` directory::
_q_exports = [ ..., 'notes', ...]
notes = StaticDirectory("/htdocs/legacy_app/notes")
|