Skip to main content

Django file storage backend and temporary file handler for Google Cloud Storage

Project description

django-gocs
===========================
[![Build Status](https://travis-ci.org/ingrammicro/django-gocs.svg?branch=master)](https://travis-ci.org/ingrammicro/django-gocs)

Google Cloud Storage file backend for Django

If you run your projects on Google's appengine and you are using the django framework you might need this
file backend since there is no way to upload files, images, etc on appengine.
Also downloadable files should use the memory to fully load before being stored in the bucket, because they
can't use temporary files in gae.

Prerequisites
-------------

You need to have an appengine project. This will not work as a standalone solution for non appengine django projects, since there is no authentication mechanism with the google cloud storage implemented.


### If you want to copy the files into your repository.

You need to install the GCS client library from
https://developers.google.com/appengine/docs/python/googlecloudstorageclient/download.

Just run `pip install GoogleAppEngineCloudStorageClient -t <your_app_directory/lib>`, or optionally, unzip the file and copy the `src/cloudstorage` folder into your project directory.

Installation
-------------

```
pip install django-gocs
```

Or Just copy the google folder in your project directory

Configuration
-------------

On your django settings.py file you need to add the following settings

GOOGLE_CLOUD_STORAGE_BUCKET = '/your_bucket_name' # the name of the bucket you have created from the google cloud storage console
GOOGLE_CLOUD_STORAGE_BUCKET_TEMP = '/your_temp_bucket_name' # bucket for temporary files
GOOGLE_CLOUD_STORAGE_URL = 'http://storage.googleapis.com/bucket' #whatever the ulr for accessing your cloud storgage bucket
GOOGLE_CLOUD_STORAGE_DEFAULT_CACHE_CONTROL = 'public, max-age: 7200' # default cache control headers for your files

And finally declare the file storage backend you will use on your settings.py file

DEFAULT_FILE_STORAGE = 'django_gocs.GoogleCloudStorage'

FILE_UPLOAD_HANDLERS = (
'django.core.files.uploadhandler.MemoryFileUploadHandler',
'django_gocs.GoogleBlobstoreTemporaryFileUploadHandler',
)

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-gocs-0.0.5.tar.gz (4.2 kB view details)

Uploaded Source

File details

Details for the file django-gocs-0.0.5.tar.gz.

File metadata

  • Download URL: django-gocs-0.0.5.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for django-gocs-0.0.5.tar.gz
Algorithm Hash digest
SHA256 15f84beb80b85a026524eeec5c1b4e6a1c5020400e9576045ce4e4094f842dbc
MD5 543e3fcaaefa13b3107f71d740e48015
BLAKE2b-256 55e315338436c1f36bb1c3460721bf6be17b05cb3865f9bff91153c8d32fe9f4

See more details on using hashes here.

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