简体   繁体   English

从python后端到Google Cloud Storage中文件的公共URL(Google App Engine)

[英]Public URL to files in Google Cloud Storage from python backend (Google App Engine)

I'm developing an Android application, which communicates with backend Google App Engine written in Python. 我正在开发一个Android应用程序,该应用程序与使用Python编写的后端Google App Engine通信。 User is uploading and downloading files to Google Cloud Storage. 用户正在将文件上传和下载到Google Cloud Storage。 So far, the files where being sent to the GAE backend by POST request, and then saved in GCS. 到目前为止,文件已通过POST请求发送到GAE后端,然后保存在GCS中。 I want user to do it directly to GCS (to avoid sending large files over POST). 我希望用户直接将其发送到GCS(以避免通过POST发送大文件)。 And (on download request) I would like to send user only public URL to file. 并且(应下载要求),我仅向用户发送文件的公共URL。 There is a nice tutorial for it in PHP: https://cloud.google.com/appengine/docs/php/googlestorage/user_upload and https://cloud.google.com/appengine/docs/php/googlestorage/public_access and key sentence there: "Once the file is written to Cloud Storage as publically readable, you need to get the public URL for the file, using CloudStorageTools::getPublicUrl." 在PHP中有一个很好的教程: https : //cloud.google.com/appengine/docs/php/googlestorage/user_uploadhttps://cloud.google.com/appengine/docs/php/googlestorage/public_access和此处的关键句:“一旦将文件以公共可读的方式写入Cloud Storage,则需要使用CloudStorageTools :: getPublicUrl获取文件的公共URL。” How to do the same in python? 如何在python中做同样的事情?

The public URL of a file in GCS looks like this: GCS中文件的公共URL如下所示:

https://storage.googleapis.com/<appname>.appspot.com/<filename>

When I store files in GCS, I explicitly give the file a filename, so I can create a serving URL using the template above. 当我在GCS中存储文件时,我为文件指定了文件名,因此可以使用上面的模板创建服务网址。

Are you giving a filename when you store files in GCS? 在GCS中存储文件时是否要提供文件名? If not, are you able to do so? 如果没有,您能够这样做吗? Maybe provided details of how you are saving the files to GCS in your question to get a better answer. 也许提供了有关如何将文件保存到问题中的GCS的详细信息,以获得更好的答案。

声明:本站的技术帖子网页,遵循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云端存储(Python) - Upload Files To Google Cloud Storage With Google App Engine (Python) 从 Google App Engine 修改 Google Cloud Storage 中的文件 - Modifying files in Google Cloud Storage from Google App Engine 在Google App Engine(python)中从Google Cloud Storage读取文件时发生内存泄漏 - Memory leak in reading files from Google Cloud Storage at Google App Engine (python) Python App Engine通过Google Cloud Storage提供文件 - Python App Engine serving files with Google Cloud Storage 无法在Google App Engine和Python上显示来自云存储的图像 - Trouble displaying image from cloud storage on Google App Engine, Python Google App Engine:如何将大型文件写入Google云端存储 - Google App Engine: How to write large files to Google Cloud Storage ferris2-framework,python,google app引擎,云存储-上传图像并将其公开吗? - ferris2-framework, python, google app engine, cloud storage — uploading an image and making it public? Google App Engine + Google Cloud Storage + Sqlite3 + Django / Python - Google App Engine + Google Cloud Storage + Sqlite3 + Django/Python 如何从Google App Engine读取Google Cloud Storage文件 - How to read a Google Cloud Storage file from Google App Engine
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM