DEPOT is a framework for easily storing and serving files in web applications on Python2.6+ and Python3.2+.
Installing DEPOT can be done from PyPi itself by installing the filedepot distribution:
$ pip install filedepot
To start using Depot refer to Documentation
DEPOT was presented at PyConUK and PyConFR in 2014
Here is a simple example of using depot standalone to store files on MongoDB:
from depot.manager import DepotManager
# Configure a *default* depot to store files on MongoDB GridFS
DepotManager.configure('default', {
'depot.backend': 'depot.io.gridfs.GridFSStorage',
'depot.mongouri': 'mongodb://localhost/db'
})
depot = DepotManager.get()
# Save the file and get the fileid
fileid = depot.create(open('/tmp/file.png'))
# Get the file back
stored_file = depot.get(fileid)
print stored_file.filename
print stored_file.content_type
depot.io.boto3.S3Storagenow provides support for accessing S3 withboto3. The previously existingdepot.io.awss3.S3Storagecan still be used to store files on S3 usingboto.- SQLAlchemy integration now handles deletion of files on rollback when session is not flushed. Previously flushing the session was required before a rollback too.
- It is now possible to run tests through
toxand build docs throughtox -e docs - DEPOT is now tested against Python 3.6
- Fixed installation error on non-UTF8 systems
- Improved support for polymorphic subtypes in SQLAlchemy
- Support for Python 3.5
- Fixed
Content-Dispositionheader for filenames including a comma
MemoryFileStoragenow accepts any option, for easier testing configuration
- Fixed
Content-Dispositionheader when serving from S3 directly - Fixed size of SQLAlchemy field on Oracle (was bigger than the allowed maximum)
MemoryFileStorageprovides in memory storage for files. This is meant to provide a convenient way to speed up test suites and avoid fixture clean up issues.- S3Storage can now generate public urls for private files (expire in 1 year)
- Files created from plain bytes are now named "unnamed" instead of missing a filename.
S3Storagenow supports theprefixoption to store files in a subpath
- Storages now provide a
listmethod to list files available on the store (This is not meant to be used to retrieve files uploaded by depot as it lists all the files). DepotExtensionfor Ming is now properly documented
- It is now possible to use multiple
WithThumbnailFilterto generate multiple thumbnails with different resolutions. - Better documentation for MongoDB
UploadedFileProperty
- Fixed a bug with Ming support when acessing
UploadedFilePropertyas a class property - Improved support for DEPOT inside TurboGears admin when using MongoDB
- Added
DepotManager.aliasto configure aliases to storage. This allows easy migration from one storage to another by switching where the alias points. - Now
UploadedFileFieldpermits to specifyupload_storageto link a Model Column to a specific storage. - Added
policyandencrypt_keyoptions to S3Storage to upload private and encrypted files.
- Added host option to S3Storage to allow using providers different from AWS.
- Added FileIntent to explicitly provide content_type and filename to uploaded content.
- Added Content-Disposition header with original filename in WSGI middleware
- Work-Around for issue with wsgi.file_wrapper provided by Waitress WSGI Server
- Official Support for AWS S3 on Python3
