Heroku上的媒体文件

问题描述:

如果我在Heroku上托管了一个小型Django网站,而我仅使用一个dyno,是否可以保存该服务器上的媒体文件,还是我必须使用AWS S3存储来存储媒体文件?媒体存储还有哪些其他选择?

If I host a small Django website on Heroku and I am using just one dyno, is it save to upload media files on that server, or should I necessarily use AWS S3 storage to store media files? What are other alternatives for media storage?

否,将内容存储在Heroku文件系统上永远都不安全.即使您只有一个dyno,它仍然是短暂的,可以随时被杀死.例如当您推送新代码时.

No, it is never safe to store things on the Heroku filesystem. Even though you only have one dyno, it is still ephemeral, and can be killed at any time; for example when you push new code.