7
votes

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?

1
How are you storing objects in the development environment?Nick
Did you ever figure this out? Still having the same question, 3 years later.Sam Ballantyne
@SamBallantyne I never did. Hopefully things have changed since then!Dan

1 Answers

2
votes

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