Skip to main content

StaticFilesStorage

Standard file system storage for static files.

Attributes

AttributeTypeDescription
locationstring = settings.STATIC_ROOTThe absolute file system path to the directory where static files are stored, defaulting to the STATIC_ROOT setting.
base_urlstring = settings.STATIC_URLThe URL that serves the static files stored in this location, defaulting to the STATIC_URL setting.
base_locationstringInternal storage for the original location path, which is set to None if no location is provided to prevent fallback to media settings.

Constructor

Signature

def StaticFilesStorage(
location: string = None,
base_url: string = None,
*args: any,
**kwargs: any
) - > null

Parameters

NameTypeDescription
locationstring = NoneThe local filesystem path where static files are stored.
base_urlstring = NoneThe URL that serves the files stored at this location.
*argsanyVariable length argument list.
**kwargsanyArbitrary keyword arguments.

Signature

def StaticFilesStorage(
location: string = None,
base_url: string = None,
*args: any,
**kwargs: any
)

Parameters

NameTypeDescription
locationstring = NoneThe absolute filesystem path where static files are stored; defaults to the STATIC_ROOT setting.
base_urlstring = NoneThe URL prefix used to serve static files; defaults to the STATIC_URL setting.
*argsanyVariable length argument list passed to the parent FileSystemStorage class.
**kwargsanyArbitrary keyword arguments passed to the parent FileSystemStorage class.

Methods


path()

@classmethod
def path(
name: string
) - > string

Returns the absolute local filesystem path for the given file name after verifying that a storage location is configured.

Parameters

NameTypeDescription
namestringThe relative path or filename of the static asset to resolve.

Returns

TypeDescription
stringThe full absolute filesystem path to the requested static file.