Images disappear after few hours

半腔热情 提交于 2019-12-11 09:47:05

问题


I want to create little ticket system : http://ticketsystemkm.herokuapp.com/
I got posters for movies to display them on main site.
When i make new movie everything works good, but after few hours images disappear. Maybe someone had similar problem and know how to solve it.


回答1:


Guessing your images are user uploads via Paperclip, or something of the like, to your public folder, which is why they're disappearing. If your app doesn't receive any traffic for 15 minutes or so, the VM it lives on is destroyed, and the public folder goes along with it.

You need to store your assets on S3, or some of other CDN. The other option is to check the relevant assets into version control into app/assets/images.

A more detailed explanation (and solution) can be found here: https://devcenter.heroku.com/articles/paperclip-s3




回答2:


Issue can happen if you change default_url of uploader or uploaded files has been deleted

You should check something: - image path in website - default_url in uploader - file in that path exist

I think we cannot store files in heroku, maybe it's cleared frequently If upload file is cleared by heroku, you should store it external(S3, Azure Storage, Google Cloud Storage, ...)



来源:https://stackoverflow.com/questions/34640933/images-disappear-after-few-hours

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