Skip to main content

a Django storage backend using GCS JSON API

Project description

django-gapc-storage

django-gapc-storage is a Django storage backend for Google Cloud Storage using the JSON API through google-api-python-client.

Requirements

  • Django 1.8+

Settings

Set the GCS_BUCKET environment variable to the GCS bucket to be used by the storage backend.

Settings can be customized via the GAPC_STORAGE settings dict:

GAPC_STORAGE = {
    "allow_overwrite": False,
    "bucket": "my-bucket",
    "cache_control": "public, max-age=3600",
    "num_retries": 0,
    "path_prefix": "",
}

GAPC_STORAGE["allow_overwrite"]

Default: False

If True, the storage backend will overwrite an existing object with the same name.

GAPC_STORAGE["bucket"]

Default: os.environ["GCS_BUCKET"]

GAPC_STORAGE["cache_control"]

Default: public, max-age=3600

By default, public-readable objects on GCS have a cache duration of 60 minutes. Set cache_control to private, max-age=0 to disable public caching of objects saved by the storage backend.

GAPC_STORAGE["num_retries"]

Default: 0

Passed to the supported methods on the underlying google-api-python-client client which will retry 500 error responses with randomized exponential backoff.

For more information, see the google-api-python-client documentation.

GAPC_STORAGE["path_prefix"]

Default: ""

A prefix appended to the path of objects saved by the storage backend. For example, configuring path_prefix to media would save objects to my-bucket/media.

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

django-gapc-storage-0.5.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

django_gapc_storage-0.5.0-py2.py3-none-any.whl (5.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-gapc-storage-0.5.0.tar.gz.

File metadata

File hashes

Hashes for django-gapc-storage-0.5.0.tar.gz
Algorithm Hash digest
SHA256 775bf2e85877810ab9f5a3e0df38466e71d4bd6ef8b39c86f0e2a60856e8af20
MD5 ccf02bd444f17b8c06d3c1922a12b410
BLAKE2b-256 eb660c6443afffdf864a88f49c42700ef8b22f0d54fc78a2a44b31490a92d868

See more details on using hashes here.

Provenance

File details

Details for the file django_gapc_storage-0.5.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_gapc_storage-0.5.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 37c490f87f2e3cab3fd90b7698fe94f988aa435c1def497dafdbc4429e01f881
MD5 30177e2636c96e7d50bad2a7826432d5
BLAKE2b-256 08ec7858c58ff1462ef1e446809f2781a12cd837d3a59ee2cdc8a6450b21ae85

See more details on using hashes here.

Provenance

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