Django 5.1.dev 文档

django.core.files.storage 源代码

from django.conf import DEFAULT_STORAGE_ALIAS
from django.utils.functional import LazyObject

from .base import Storage
from .filesystem import FileSystemStorage
from .handler import InvalidStorageError, StorageHandler
from .memory import InMemoryStorage

__all__ = (
    "FileSystemStorage",
    "InMemoryStorage",
    "Storage",
    "DefaultStorage",
    "default_storage",
    "InvalidStorageError",
    "StorageHandler",
    "storages",
)


[文档] class DefaultStorage(LazyObject): def _setup(self): self._wrapped = storages[DEFAULT_STORAGE_ALIAS]
storages = StorageHandler() default_storage = DefaultStorage()