简体   繁体   English

如何在App Engine开发服务器上获取Google Cloud Storage文件对象的服务URL?

[英]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.

相关问题 获取文件的公共 URL - Google Cloud Storage - App Engine (Python) - Get Public URL for File - Google Cloud Storage - App Engine (Python) 如何通过Google App Engine中的应用程序将文件写入Google Cloud Storage? - How do I write a file through my app in the Google App Engine to the Google Cloud Storage? Python App Engine通过Google Cloud Storage提供文件 - Python App Engine serving files with Google Cloud Storage 如何从Google App Engine读取Google Cloud Storage文件 - How to read a Google Cloud Storage file from Google App Engine 在python Google App Engine 中,如何将模型的所有实体导出到Google Storage 中的文件中以供开发人员使用? - In the python Google App Engine, how do I export all the entities of a model to a file in Google Storage for developers? 防止Google App Engine中的get_serving_url()热链接 - Prevent hot linking for get_serving_url() in Google App Engine 谷歌应用程序引擎get_serving_url()未定义 - google app engine get_serving_url() is not defined 从应用引擎访问谷歌云存储帐户对象 - Access google cloud storage account objects from app engine 如何使这个 Flask 应用程序适用于 Google Cloud Engine? - How do I make this flask app suitable for Google Cloud Engine? 使用Google App Engine检索大文件(http GET)并存储在云存储中 - Use Google App Engine to retrieve large file (http GET) and store in Cloud Storage
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM