How do I have a persistent file storage when deploying to Heroku?

北慕城南 提交于 2020-11-25 03:44:22

问题


I know that Heroku's dyno gets refreshed each time a deploy is made so is there anyway I can have my files persistent or there's no other way but use services like amazon S3? I use paperclip to handle file upload and most of the files will be in pdf.


回答1:


It would be best to use S3 or another service.

Ephemeral filesystem

Each dyno gets its own ephemeral filesystem, with a fresh copy of the most recently deployed code. During the dyno’s lifetime its running processes can use the filesystem as a temporary scratchpad, but no files that are written are visible to processes in any other dyno and any files written will be discarded the moment the dyno is stopped or restarted. For example, this occurs any time a dyno is replaced due to application deployment and approximately once a day as part of normal dyno management.

https://devcenter.heroku.com/articles/dynos#ephemeral-filesystem



来源:https://stackoverflow.com/questions/39091667/how-do-i-have-a-persistent-file-storage-when-deploying-to-heroku

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