如何使用 Google App Engine 将图像上传到 Google 云存储?
How to upload images to Google Cloud Storage using Google App Engine?
我正在尝试找到一种使用 Google App Engine 将图像上传到 Google 云存储的方法。
我检查过:
Sending images to google cloud storage using google app engine
Upload images/video to google cloud storage using Google App Engine
他们都展示了如何使用 BlobStore API。
当我查看 BlobStore API:https://cloud.google.com/appengine/docs/python/blobstore/
他们有一个说明要改用 Google 云存储。 BlobStore 目前的状态如何,未来会支持吗?
我看到一个图片上传示例:https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/appengine/standard/blobstore/main.py 使用 BlobStore API。
是否有使用 Google App Engine 的 Google 云存储示例?
通过App Engine上传图片存在三个问题:
首先,它非常低效。您正在使用 App Engine 实例小时来简单地将数据从用户的浏览器传递到 Google Cloud Storage。
其次,速度较慢(同样,因为您使用了中介)。
最后,App Engine 不支持流式传输,所有请求都限制在 32MB 以内。
最好的选择是使用 upload options 之一将文件直接上传到云存储。
我赞成上述答案,因为您应该尽可能避免通过 App Engine 传递数据。如果您真的需要将图像(或任何其他数据)从 App Engine 上传到 Python 中的 Google Cloud Storage,答案就像 ChrisC73 指出的那样使用 GoogleAppEngineCloudStorageClient,因为那里在 Python 运行时没有为 Cloud Storage 内置 API。
相比之下,PHP 运行时具有 built-in support 用于 Google 具有标准文件系统功能的云存储。
我最终使用了 https://cloud.google.com/appengine/docs/python/googlecloudstorageclient/app-engine-cloud-storage-sample(GCS 客户端@ChrisC73 指出。
此外,参考@vocausa 的 signed_url 项目:https://github.com/voscausa/appengine-gcs-signed-url
我正在尝试找到一种使用 Google App Engine 将图像上传到 Google 云存储的方法。
我检查过:
Sending images to google cloud storage using google app engine
Upload images/video to google cloud storage using Google App Engine
他们都展示了如何使用 BlobStore API。
当我查看 BlobStore API:https://cloud.google.com/appengine/docs/python/blobstore/
他们有一个说明要改用 Google 云存储。 BlobStore 目前的状态如何,未来会支持吗?
我看到一个图片上传示例:https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/appengine/standard/blobstore/main.py 使用 BlobStore API。
是否有使用 Google App Engine 的 Google 云存储示例?
通过App Engine上传图片存在三个问题:
首先,它非常低效。您正在使用 App Engine 实例小时来简单地将数据从用户的浏览器传递到 Google Cloud Storage。
其次,速度较慢(同样,因为您使用了中介)。
最后,App Engine 不支持流式传输,所有请求都限制在 32MB 以内。
最好的选择是使用 upload options 之一将文件直接上传到云存储。
我赞成上述答案,因为您应该尽可能避免通过 App Engine 传递数据。如果您真的需要将图像(或任何其他数据)从 App Engine 上传到 Python 中的 Google Cloud Storage,答案就像 ChrisC73 指出的那样使用 GoogleAppEngineCloudStorageClient,因为那里在 Python 运行时没有为 Cloud Storage 内置 API。
相比之下,PHP 运行时具有 built-in support 用于 Google 具有标准文件系统功能的云存储。
我最终使用了 https://cloud.google.com/appengine/docs/python/googlecloudstorageclient/app-engine-cloud-storage-sample(GCS 客户端@ChrisC73 指出。
此外,参考@vocausa 的 signed_url 项目:https://github.com/voscausa/appengine-gcs-signed-url