+
Skip to content

armandtvz/python-file-storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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).

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载