是否可以通过url将文件上传到App Engine上的云存储,而无需写入磁盘? [英] Is it possible to upload a file by url to cloud storage on app engine without writing to disk?

查看:75
本文介绍了是否可以通过url将文件上传到App Engine上的云存储,而无需写入磁盘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要将文件从url上传到云存储系统,通常需要将该文件下载到服务器上,然后再将其上传到云存储.

To upload a file from url to a cloud storage system, usually it is required to download that file on a server, and then upload it to the cloud storage.

对于大文件,可能需要将文件写到磁盘而不是内存上.由于App Engine不支持在磁盘上进行写入,因此在App Engine上还有其他选择吗?

For large files, it may be required to write the file on disk instead of memory. Since app engine does not support writing on disks, are there any other options for doing this on app engine?

我知道托管虚拟机是一个选项,但我试图确保绝对不可能在经典应用程序引擎上执行此操作.

I understand that managed vm is an option, but I'm trying to make sure that it's definitely not possible to do this on classic app engine.

推荐答案

要克服GAE上缺少本地磁盘的问题,您可以:

To overcome the lack of local disk on GAE you can:

  • use the blobstore
  • better yet, use directly the cloud storage: Upload images/video to google cloud storage using Google App Engine, Sending images to google cloud storage using google app engine.

要将文件下载到GAE,您可以使用 URL服务 .但是要注意两个限制:

To download the files to GAE you could use the URL service. But there are 2 limitations to keep an eye on:

  • the file download duration causing DeadlineExceededErrors in url fetching, you could bump it to 10 min on background tasks, see App Engine Python UrlFetch.set_default_fetch_deadline
  • the max URL fetch response size of 32M, for which the Sockets service appears to be a workaround (paid apps only): see GAE - urlfetch multipart post not working with large files

如果提供下载的服务器支持多部分下载,则可能可以通过此信息获得适用于任何文件大小的解决方案.

If the server offering the downloads supports multi-part downloads it might be possible to get a solution working for any file sizes with this info.

注意:这只是理论上的,我只是考虑过而已,实际上并没有尝试过.

Note: this is just theoretical, I've only thought about this, I didn't actually tried it.

这篇关于是否可以通过url将文件上传到App Engine上的云存储,而无需写入磁盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆