Views and functions for serving static files. These are only to be used during development, and SHOULD NOT be used in a production setting.
Function | directory |
Undocumented |
Function | serve |
Serve static files below a given point in the directory structure. |
Function | was |
Was something modified since the user last downloaded it? |
Constant | DEFAULT |
Undocumented |
Variable | template |
Undocumented |
Serve static files below a given point in the directory structure. To use, put a URL pattern such as:: from django.views.static import serve path('<path:path>', serve, {'document_root': '/path/to/my/files/'}) in your URLconf. You must provide the ``document_root`` param. You may also set ``show_indexes`` to ``True`` if you'd like to serve a basic index of the directory. This index view will use the template hardcoded below, but if you'd like to override it, you can create a template called ``static/directory_index.html``.
Was something modified since the user last downloaded it? header This is the value of the If-Modified-Since header. If this is None, I'll just return True. mtime This is the modification time of the item we're talking about.