Storing files is a necessary function of any modern web application. This page describes how to store files on different storage backends using GeniePy.

Description

GeniePy supports storing files through a few different service providers. This works primarily through setting a few core environment variables followed by setting a few environment variables specific to the service provider you're using.

Configuration

Set the STORAGE_BACKEND environment variable to tell GeniePy what kind of storage backend you're planning to use.

This variable supports the following values:

  1. disk: configures GeniePy to store data on local disk
  2. s3: configures GeniePy to store data on an Amazon S3 storage bucket of your choice
  3. gcs: configures GeniePy to store data on a Google Cloud Storage bucket of your choice

With this environment variable in place, we can move on to configuring the individual storage providers.

Disk Storage

Specify a valid value for the STORAGE_BACKEND_DISK_BASE_PATH environment variable.

This environment variable is how GeniePy knows where on disk to store all the data. The default value is set to /tmp/app.

Amazon S3

Specify valid values for the following four environment variabes:

  1. STORAGE_BACKEND_S3_REGION: the geographical region your S3 bucket is configured to be in
  2. STORAGE_BACKEND_S3_BUCKET: your bucket's name
  3. STORAGE_BACKEND_S3_ACCESS_KEY_ID: your API access key ID
  4. STORAGE_BACKEND_S3_SECRET_ACCESS_KEY: your API secret access key

Google Cloud Storage

Specify valid values for the following two environment variables:

  1. STORAGE_BACKEND_GCS_APPLICATION_CREDENTIALS: the application credentials file issued by Google that is allowed to access data on your bucket
  2. STORAGE_BACKEND_GCS_BUCKET: your bucket's name