Skip to main content

A Python package that exposes a consistent API for working with different storage backends.

Project description

python-file-storage

A Python package that exposes a consistent API for working with different storage backends.

WARNING: This is still under active development.

Why does this package exist?

I needed something that does not depend on Django but exposes a similar interface to Django's base storage in django.core.files.storage.base.Storage. So, if you're using Django: use Django and django-storages instead. Currently, this package only does the bare minimum that I need it for so if you're looking for something more full-featured perhaps look at the cloudstorage package.

Available backends

  • Filesystem.
  • Amazon S3.

Quickstart

  1. Install the package:

    pip install python-file-storage
    
  2. Add your configuration. Set the following as environment variables or add them to a .env file in the root of your project:

    DEFAULT_STORAGE_BACKEND = storage.backends.s3.S3Storage
    S3_BUCKET_NAME = my-bucket-name
    S3_ENDPOINT_URL = example.com # Optional
    S3_ACCESS_KEY_ID = 123
    S3_SECRET_ACCESS_KEY = 123
    

    Currently, using more than one storage backend at a time is unsupported.

  3. Import default_storage and start using the package:

    from storage import default_storage
    
    default_storage.save('example.txt', 'Content')
    file = default_storage.open('example.txt', 'Content')
    

Compatibility

  • Python 3.8+
  • Django is unsupported.

Versioning

This project follows semantic versioning (SemVer).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-file-storage-0.3.0.tar.gz (15.6 kB view hashes)

Uploaded Source

Built Distribution

python_file_storage-0.3.0-py3-none-any.whl (19.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page