Skip to content

StorageManager

sqlalchemy_file.storage.StorageManager

Takes care of managing the whole Storage environment for the application.

Use add_storage method to add new libcloud.storage.base.Containerand associate a name which will be use later to retrieve this container.

The first container will be used as default, to simplify code when you have only one container.

Use associated name as upload_storage for FileField to store his files inside the corresponding container.

add_storage(name, container) classmethod

Add new storage.

delete_file(path) classmethod

Delete the file with provided path.

The path is expected to be storage_name/file_id.

get(name=None) classmethod

Gets the container instance associate to the name, return default if name isn't provided.

get_default() classmethod

Gets the current application default storage.

get_file(path) classmethod

Retrieve the file with provided path.

The path is expected to be storage_name/file_id.

set_default(name) classmethod

Replaces the current application default storage.