Skip to content
Tomasz Szymański edited this page Feb 10, 2022 · 7 revisions

Installation

Install the simple-storage package:

pip install simple-storage

Configuration

Select the storage type by setting the STORAGES_BACKEND environment variable to one of the following values:

  • storages.backends.file_system.FileSystemStorage - for File System Storage
  • storages.backends.amazon_s3.AmazonS3Storage - for AWS S3 Storage
  • storages.backends.google_cloud.GoogleCloudStorage - for Google Cloud Storage

Example:

export STORAGES_BACKEND=storages.backends.file_system.FileSystemStorage

Storages

File System Storage

For this storage you need to point the existing path in your file system, where all the data would be stored.

To do so you need to set the STORAGES_PATH environment variable to the existing path of your choice.

Example

export STORAGES_PATH=/app/media

AWS S3 Bucket Storage

For this storage you need to set the following environment variables:

  • STORAGES_AWS_ACCESS_KEY_ID - Your AWS access key ID.
  • STORAGES_AWS_SECRET_ACCESS_KEY - Your AWS secret access key.
  • STORAGES_AWS_BUCKET_NAME - The bucket name that you want to use.

Example:

export STORAGES_AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
export STORAGES_AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
export STORAGES_AWS_BUCKET_NAME=your-example-bucket-name

In case you encounter any problems with finding your AWS credentials please read this page as a reference.

Google Cloud Storage

For this storage you need to set the following environment variables:

  • STORAGES_GOOGLE_CLOUD_CREDENTIALS - Your Google Cloud credentials Base64-encoded
  • STORAGES_GOOGLE_CLOUD_BUCKET_NAME - The bucket name that you want to use.

Example:

export STORAGES_GOOGLE_CLOUD_CREDENTIALS=h5vn7nht4nhv547bghw75vbt5nhtp5wn
export STORAGES_GOOGLE_CLOUD_BUCKET_NAME=your-example-bucket-name

In case you encounter any problems with finding your Google Cloud credentials JSON file please follow this guide.

Clone this wiki locally