storing static images in the blobstore

主宰稳场 提交于 2019-12-11 17:57:56

问题


Normally to host a website on app-engine, I can put all my image files in a static directory, say img, and then in the yaml file have

  • url: /img static_dir: img

Such a usage makes sense when the images are for displaying in my website itself.

But now I have an endpoint api. For my case, I need to store some images in my backend for my users to access. Instead of putting them in static directory, I want to put them in the blobstore and use blob serving url to serve them. Is there a way to deploy images to the blobstore and then get the serving urls?


回答1:


You could implement a task that checks if the files are in the blobstore or not, and if not, uploads them to the blobstore. Then you can run this task in cron or as a warmup task.

Still, it will be best for you to use the static web serving and pull the static files in HTTP from the static storage. It will perform much better than blobstore (in fact, it performs much better than most static web hosting), and will cost you less.



来源:https://stackoverflow.com/questions/16509796/storing-static-images-in-the-blobstore

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!