sajal garg
sajal garg

Reputation: 139

Upload and retrieve files from Google Cloud Storage/ Buckets in Python/Django

I want to upload and retrieve file (that includes image and csv) for my django application.

My project is currently hosted on Google App Engine Flexible. From my understanding, I need to use Google Cloud Buckets for the process. But I could not find relevant material online for the process.

GoogleAppEngineCloudStorageClient API also provides the feature of writing a file and reading it:

cloudstorage.open(filename, mode='r', content_type=None, options=None, read_buffer_size=storage_api.ReadBuffer.DEFAULT_BUFFER_SIZE, retry_params=None)

Please point me to the relevant resources for the same. Since I am new to Django and Google Cloud, I would really appreciate if you could share code snippets with me.

Thanks in advance.

Upvotes: 3

Views: 3561

Answers (2)

Andie Vanille
Andie Vanille

Reputation: 820

As per the official documentation of Google App Engine Flexible, you can configure upload and retrieve files in different runtimes environments. I went through the documentation and I found that you need to create a Cloud Storage bucket in order to stock your files.Keep in mind that it's only for static content. I recommend to take a look at this documentation where you may find valuable information.

Please let me know how it goes.

Upvotes: 0

Ken4scholars
Ken4scholars

Reputation: 6296

Check the Google storage section of Django Storages. It may help to read generally about the storage system used in Django before going to Google storage in detail.

Upvotes: 3

Related Questions