Dan
Dan

Reputation: 5323

How do I get the serving URL for Google Cloud Storage file objects on App Engine dev server?

I have a python App Engine app and save files using the Google Cloud Storage API. However I need to get the serving URL for each file.

On production it is easy to figure out what the serving URL is as I prepend http://commondatastorage.googleapis.com to /bucket/path/to/file.txt as I already have the bucket name and path to my file.

How do I figure out what the serving URL is on the dev server?

It seems straight forward enough to do this with images using images.get_serving_url which can now take either blobstore or Cloud Storage references.

How can I figure out the serving URL for all files, not just images in a way that is compatible with both the development and production App Engine environments?

Upvotes: 7

Views: 4876

Answers (1)

jterrace
jterrace

Reputation: 67163

You can use GCS via the blobstore API. See this section for how to set up a serving handler for a GCS key:

https://developers.google.com/appengine/docs/python/blobstore/#Python_Using_the_Blobstore_API_with_Google_Cloud_Storage

Upvotes: 2

Related Questions