Support for many storages (S3, Libcloud, etc in Django.
Installing from PyPI is as easy as doing:
pip install django-storages
If you’d prefer to install from source (maybe there is a bugfix in master that hasn’t been released yet) then the magic incantation you are looking for is:
pip install -e 'git+https://github.com/jschneier/django-storages.git#egg=django-storages'
Once that is done add storages to your INSTALLED_APPS and set DEFAULT_FILE_STORAGE to the backend of your choice. If, for example, you want to use the s3boto backend you would set:
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
There are also a number of settings available to control how each storage backend functions, please consult the documentation for a comprehensive list.
django-storages is a project to provide a variety of storage backends in a single library.
This library is usually compatible with the currently supported versions of Django. Check the trove classifiers in setup.py to be sure.
This repo began as a fork of the original library under the package name of django-storages-redux and became the official successor (releasing under django-storages on PyPI) in February of 2016.
Found a Bug? Something Unsupported?
I suspect that a few of the storage engines in backends/ have been unsupported for quite a long time. I personally only really need the S3Storage backend but welcome bug reports (and especially) patches and tests for some of the other backends.
Issues are tracked via GitHub issues at the project issue page.
The original documentation for django-storages is located at https://django-storages.readthedocs.org/. Stay tuned for forthcoming documentation updates.
- Check for open issues at the project issue page or open a new issue to start a discussion about a feature or bug.
- Fork the django-storages repository on GitHub to start making changes.
- Add a test case to show that the bug is fixed or the feature is implemented correctly.
- Bug me until I can merge your pull request. Also, don’t forget to add yourself to AUTHORS.
django-storages change log
- Actually use SFTP_STORAGE_HOST in SFTPStorage backend (#204 thanks @jbittel)
- Fix S3Boto3Storage to avoid race conditions in a multi-threaded WSGI environment (#238 thanks @jdufresne)
- Fix trying to localize a naive datetime when settings.USE_TZ is False in S3Boto3Storage.modified_time. (thanks to @tomchuk and @piglei for the reports and the patches, #235, #234)
- Fix automatic bucket creation in S3Boto3Storage when AWS_AUTO_CREATE_BUCKET is True (#196 thanks @linuxlewis)
- Improve the documentation for the S3 backends (thanks to various contributors!)
- Drop support for Django 1.7 (#185)
- Deprecate hashpath, image, overwrite, mogile, symlinkorcopy, database, mogile, couchdb. See (issue #202) to discuss maintenance going forward
- Use a fixed mtime argument for GzipFile in S3BotoStorage and S3Boto3Storage to ensure a stable output for gzipped files
- Use .putfileobj instead of .put in S3Boto3Storage to use the transfer manager, allowing files greater than 5GB to be put on S3 (#194 , #201)
- Update S3Boto3Storage for Django 1.10 (#181) (get_modified_time and get_accessed_time) thanks @JshWright
- Fix bad kwarg name in S3Boto3Storage when AWS_PRELOAD_METADATA is True (#189, #190) thanks @leonsmith
- Add new backend S3Boto3Storage (#179) MASSIVE THANKS @mbarrien
- Add a strict option to utils.setting (#176) thanks @ZuluPro
- Tests, documentation, fixing .close for SFTPStorage (#177) thanks @ZuluPro
- Tests, documentation, add .readlines for FTPStorage (#175) thanks @ZuluPro
- Tests and documentation for DropBoxStorage (#174) thanks @ZuluPro
- Fix MANIFEST.in to not ship .pyc files. (#145) thanks @fladi
- Enable CI testing of Python3.5 and fix test failure from api change (#171) thanks @tnir
- Fix DropBoxStorage.exists check and add DropBoxStorage.url (#127) thanks @zuck
- Add GS_HOST setting (with a default of GSConnection.DefaultHost) to fix GSBotoStorage. Issue #124. Fixed in #125. Thanks @patgmiller @dcgoss.
- This package is now released on PyPI as django-storages. Please update your requirements files to django-storages==1.4.
- Fix memory leak from not closing underlying temp file in s3boto backend (#106) thanks @kmmbvnr
- Allow easily specifying a custom expiry time when generating a url for S3BotoStorage (#96) thanks @mattbriancon
- Check for bucket existence when the empty path (‘’) is passed to storage.exists in S3BotoStorage - this prevents a crash when running collecstatic -c on Django 1.9.1 (#112) fixed in #116 thanks @xblitz
- A few Azure Storage fixes [pass the content-type to Azure, handle chunked content, fix url] (#45) thanks @erlingbo
- Add support for a Dropbox (dropbox) storage backend, thanks @ZuluPro (#76)
- Various fixes to the apache_libcloud backend [return the number of bytes asked for by .read, make .name non-private, don’t initialize to an empty BytesIO object] thanks @kaedroho (#55)
- Fix multi-part uploads in s3boto backend not respecting AWS_S3_ENCRYPTION (#94) thanks @andersontep
- Automatically gzip svg files thanks @comandrei (#100)
- Drop Support for Django 1.5 and Python2.6
- Remove previously deprecated mongodb backend
- Remove previously deprecated parse_ts_extended from s3boto storage
- Add support for Django 1.8+ (#36)
- Add AWS_S3_PROXY_HOST and AWS_S3_PROXY_PORT settings for s3boto backend (#41)
- Fix Python3K compat issue in apache_libcloud (#52)
- Fix Google Storage backend not respecting GS_IS_GZIPPED setting (#51, #60) thanks @stmos
- Rename FTP _name attribute to name which is what the Django File api is expecting (#70)
- Put StorageMixin first in inheritance to maintain backwards compat with older versions of Django (#63)
- Variety of FTP backend fixes (fix exists, add modified_time, remove call to non-existent function) (#26)
- Apparently the year changed to 2015
- Add support for Django 1.7 migrations in S3BotoStorage and ApacheLibCloudStorage (#5, #8)
- Python3K (3.3+) now available for S3Boto backend (#4)
- Remove legacy S3 storage (#1)
- Remove mosso files backend (#2)
NOTE: Version 1.1.9 is the first release of django-storages after the fork. It represents the current (2014-12-08) state of the original django-storages in master with no additional changes. This is the first release of the code base since March 2013.
- Fix syntax for Python3 with pull-request #91
- Support pushing content type from File object to GridFS with pull-request #90
- Support passing a region to the libcloud driver with pull-request #86
- Handle trailing slash paths fixes #188 fixed by pull-request #85
- Use a SpooledTemporaryFile to conserve memory in S3BotoFile pull-request #69
- Guess content-type for S3BotoStorageFile the same way that _save() in S3BotoStorage does
- Pass headers and response_headers through from url to generate_url in S3BotoStorage pull-request #65
- Added AWS_S3_HOST, AWS_S3_PORT and AWS_S3_USE_SSL settings to specify host, port and is_secure in pull-request #66
Everything Below Here Was Previously Released on PyPi under django-storages
- Fixes #156 regarding date parsing, ValueError when running collectstatic
- Proper handling of boto dev version parsing
- Made SFTP URLs accessible, now uses settings.MEDIA_URL instead of sftp://
- Listing of huge buckets on S3 is now prevented by using the prefix argument to boto’s list() method
- Initial support for Windows Azure Storage
- Switched to useing boto’s parse_ts date parser getting last modified info when using S3boto backend
- Fixed key handling in S3boto and Google Storage backends
- Account for lack of multipart upload in Google Storage backend
- Fixed seek() issue when using AWS_IS_GZIPPED by darkness51 with pull-request #50
- Improvements to S3BotoStorage and GSBotoStorage
- Merged many changes from Jannis Leidel (mostly regarding gzipping)
- Fixed tests by Ian Lewis
- Added support for Google Cloud Storage backend by Jannis Leidel
- Updated license file by Dan Loewenherz, fixes #133 with pull-request #44
- Set Content-Type header for use in upload_part_from_file by Gerardo Curiel
- Pass the rewind parameter to Boto’s set_contents_from_file method by Jannis Leidel with pull-request #45
- Fix for FTPStorageFile close() method by Mathieu Comandon with pull-request #43
- Minor refactoring by Oktay Sancak with pull-request #48
- Ungzip on download based on Content-Encoding by Gavin Wahl with pull-request #46
- Add support for S3 server-side encryption by Tobias McNulty with pull-request #17
- Add an optional setting to the boto storage to produce protocol-relative URLs, fixes #105
- Merged pull request #36 from freakboy3742 Keith-Magee, improvements to Apache Libcloud backend and docs
- Merged pull request #35 from atodorov, allows more granular S3 access settings
- Add support for SSL in Rackspace Cloudfiles backend
- Fixed the listdir() method in s3boto backend, fixes #57
- Added base url tests for safe_join in s3boto backend
- Merged pull request #20 from alanjds, fixed SuspiciousOperation warning if AWS_LOCATION ends with ‘/’
- Added FILE_BUFFER_SIZE setting to s3boto backend
- Merged pull request #30 from pendletongp, resolves #108, #109 and #110
- Updated the modified_time() method so that it doesn’t require dateutil. fixes #111
- Merged pull request #16 from chamal, adds Apache Libcloud backend
- When preloading the S3 metadata make sure we reset the files key during saving to prevent stale metadata
- Merged pull request #24 from tobias.mcnulty, fixes bug where s3boto backend returns modified_time in wrong time zone
- Fixed HashPathStorage.location to no longer use settings.MEDIA_ROOT
- Remove download_url from setup file so PyPI dist is used
- Added PendingDeprecationWarning for mosso backend
- Merged pull request #13 from marcoala, adds SFTP_KNOWN_HOST_FILE setting to SFTP storage backend
- Merged pull request #12 from ryankask, fixes HashPathStorage tests that delete remote media
- Merged pull request #10 from key, adds support for django-mongodb-engine 0.4.0 or later, fixes GridFS file deletion bug
- Fixed S3BotoStorage performance problem calling modified_time()
- Added deprecation warning for s3 backend, refs #40
- Fixed CLOUDFILES_CONNECTION_KWARGS import error, fixes #78
- Switched to sphinx documentation, set official docs up on http://django-storages.rtfd.org/
- HashPathStorage uses self.exists now, fixes #83
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size django_storages-1.5.2-py2.py3-none-any.whl (51.2 kB)||File type Wheel||Python version 2.7||Upload date||Hashes View|
|Filename, size django-storages-1.5.2.tar.gz (61.3 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for django_storages-1.5.2-py2.py3-none-any.whl