StaticFilesStorage
Standard file system storage for static files.
Attributes
| Attribute | Type | Description |
|---|---|---|
| location | string = settings.STATIC_ROOT | The absolute file system path to the directory where static files are stored, defaulting to the STATIC_ROOT setting. |
| base_url | string = settings.STATIC_URL | The URL that serves the static files stored in this location, defaulting to the STATIC_URL setting. |
| base_location | string | Internal 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
| Name | Type | Description |
|---|---|---|
| location | string = None | The local filesystem path where static files are stored. |
| base_url | string = None | The URL that serves the files stored at this location. |
| *args | any | Variable length argument list. |
| **kwargs | any | Arbitrary keyword arguments. |
Signature
def StaticFilesStorage(
location: string = None,
base_url: string = None,
*args: any,
**kwargs: any
)
Parameters
| Name | Type | Description |
|---|---|---|
| location | string = None | The absolute filesystem path where static files are stored; defaults to the STATIC_ROOT setting. |
| base_url | string = None | The URL prefix used to serve static files; defaults to the STATIC_URL setting. |
| *args | any | Variable length argument list passed to the parent FileSystemStorage class. |
| **kwargs | any | Arbitrary 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
| Name | Type | Description |
|---|---|---|
| name | string | The relative path or filename of the static asset to resolve. |
Returns
| Type | Description |
|---|---|
string | The full absolute filesystem path to the requested static file. |