Paperclipped on Heroku?

后端 未结 5 1191
青春惊慌失措
青春惊慌失措 2021-02-14 02:25

I was curious if anyone could get paperclipped working on Heroku without using S3. I\'m assuming Heroku is a read-only system, but there must be some way to save images there.

5条回答
  •  不思量自难忘°
    2021-02-14 03:00

    You may save images to the log and tmp directories.

    However, that's a horrible, horrible idea.

    • If you git push heroku, your application will be deployed to a new dyno. The new dyno will not have the images, and the images will be forever gone.

    • If you have two dynos, and one dyno saves the image, the image will not be available to the next dyno.

    So, effectively, there is no good way to save images to the filesystem.

    If you want, you can write your own an adapter for Paperclip that will store images in the database.

    But really, you should store images in S3 when you use Paperclip on Heroku, because it's the easy default way to do it.

提交回复
热议问题