class Storage: (source)
Known subclasses: django.core.files.storage.FileSystemStorage
A base storage class, providing some default behaviors that all other storage systems can inherit or override, as necessary.
Method | delete |
Delete the specified file from the storage system. |
Method | exists |
Return True if a file referenced by the given name already exists in the storage system, or False if the name is available for a new file. |
Method | generate |
Validate the filename by calling get_valid_name() and return a filename to be passed to the save() method. |
Method | get |
Return the last accessed time (as a datetime) of the file specified by name. The datetime will be timezone-aware if USE_TZ=True. |
Method | get |
Return an alternative filename, by adding an underscore and a random 7 character alphanumeric string (before the file extension, if one exists) to the filename. |
Method | get |
Return a filename that's free on the target storage system and available for new content to be written to. |
Method | get |
Return the creation time (as a datetime) of the file specified by name. The datetime will be timezone-aware if USE_TZ=True. |
Method | get |
Return the last modified time (as a datetime) of the file specified by name. The datetime will be timezone-aware if USE_TZ=True. |
Method | get |
Return a filename, based on the provided filename, that's suitable for use in the target storage system. |
Method | listdir |
List the contents of the specified path. Return a 2-tuple of lists: the first item being directories, the second item being files. |
Method | open |
Retrieve the specified file from storage. |
Method | path |
Return a local filesystem path where the file can be retrieved using Python's built-in open() function. Storage systems that can't be accessed using open() should *not* implement this method. |
Method | save |
Save new content to the file specified by name. The content should be a proper File object or any Python file-like object, ready to be read from the beginning. |
Method | size |
Return the total size, in bytes, of the file specified by name. |
Method | url |
Return an absolute URL where the file's contents can be accessed directly by a web browser. |
django.core.files.storage.FileSystemStorage
Delete the specified file from the storage system.
django.core.files.storage.FileSystemStorage
Return True if a file referenced by the given name already exists in the storage system, or False if the name is available for a new file.
Validate the filename by calling get_valid_name() and return a filename to be passed to the save() method.
django.core.files.storage.FileSystemStorage
Return the last accessed time (as a datetime) of the file specified by name. The datetime will be timezone-aware if USE_TZ=True.
Return an alternative filename, by adding an underscore and a random 7 character alphanumeric string (before the file extension, if one exists) to the filename.
Return a filename that's free on the target storage system and available for new content to be written to.
django.core.files.storage.FileSystemStorage
Return the creation time (as a datetime) of the file specified by name. The datetime will be timezone-aware if USE_TZ=True.
django.core.files.storage.FileSystemStorage
Return the last modified time (as a datetime) of the file specified by name. The datetime will be timezone-aware if USE_TZ=True.
Return a filename, based on the provided filename, that's suitable for use in the target storage system.
django.core.files.storage.FileSystemStorage
List the contents of the specified path. Return a 2-tuple of lists: the first item being directories, the second item being files.
django.core.files.storage.FileSystemStorage
Return a local filesystem path where the file can be retrieved using Python's built-in open() function. Storage systems that can't be accessed using open() should *not* implement this method.
Save new content to the file specified by name. The content should be a proper File object or any Python file-like object, ready to be read from the beginning.
django.core.files.storage.FileSystemStorage
Return the total size, in bytes, of the file specified by name.
django.core.files.storage.FileSystemStorage
Return an absolute URL where the file's contents can be accessed directly by a web browser.