Skip to main content

static

Return a URL pattern for serving files in debug mode.

def static(
prefix: string,
view: callable,
**kwargs: dict
) - > list

Return a URL pattern for serving files in debug mode.

Parameters

NameTypeDescription
prefixstringThe URL prefix that triggers the file serving view, typically defined in settings.MEDIA_URL or settings.STATIC_URL.
viewcallableThe view function responsible for serving the files, defaulting to django.views.static.serve.
**kwargsdictAdditional keyword arguments passed to the view function, such as 'document_root' to specify the filesystem path.

Returns

TypeDescription
listA list containing a URL pattern object if in debug mode and the prefix is local; otherwise, an empty list.