[英]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. 我有一个python App Engine应用程序并使用Google Cloud Storage API保存文件。 However I need to get the serving URL for each file. 但是我需要获取每个文件的服务URL。
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. 在生产时,很容易弄清楚服务URL是什么,因为我已经将http://commondatastorage.googleapis.com
到/bucket/path/to/file.txt
因为我已经拥有了我的文件的存储桶名称和路径。
How do I figure out what the serving URL is on the dev server? 如何确定开发服务器上的服务URL是什么?
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. 使用images.get_serving_url
对图像执行此操作似乎很简单,现在可以使用blobstore或云存储引用。
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? 如何以与开发和生产App Engine环境兼容的方式找出所有文件的服务URL,而不仅仅是图像?
You can use GCS via the blobstore API. 您可以通过blobstore API使用GCS。 See this section for how to set up a serving handler for a GCS key: 有关如何为GCS密钥设置服务处理程序,请参阅本节:
https://developers.google.com/appengine/docs/python/blobstore/#Python_Using_the_Blobstore_API_with_Google_Cloud_Storage https://developers.google.com/appengine/docs/python/blobstore/#Python_Using_the_Blobstore_API_with_Google_Cloud_Storage
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.