module documentation

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 serve Serve static files below a given point in the directory structure.
Constant DEFAULT​_DIRECTORY​_INDEX​_TEMPLATE Undocumented
Variable template​_translatable Undocumented
Function directory​_index Undocumented
Function was​_modified​_since Was something modified since the user last downloaded it?
def serve(request, path, document_root=None, show_indexes=False):

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.

DEFAULT_DIRECTORY_INDEX_TEMPLATE: str =

Undocumented

Value
'''
{% load i18n %}
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <meta http-equiv="Content-Language" content="en-us">
...
template_translatable =

Undocumented

def directory_index(path, fullpath):

Undocumented

def was_modified_since(header=None, mtime=0, size=0):

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.
size
This is the size of the item we're talking about.