Git Product home page Git Product logo

django-google-cloud-storage's Introduction

django-google-cloud-storage

A file storage backend for django appengine projects that uses google cloud storage

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. Although solutions exist for the amazon cloud storage i have not found a file backend for google cloud storage. This backend does work with google cloud storage, although in early development. I have used it with regular file uploads and with file manager solutions such as django-filer. The code as it is right now stores files for public use (i.e. a web site's images)

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.

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

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_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 = 'google.storage.googleCloud.GoogleCloudStorage'

django-google-cloud-storage's People

Contributors

ckopanos avatar slurms avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.