ruby-on-rails - Heroku - 为我的项目托管文件和静态文件

标签 ruby-on-rails heroku

我想使用 Heroku 托管我的 Ruby on Rails 项目。它将涉及大量文件上传,主要是图像。我可以在 Heroku 上托管和提供静态文件吗?或者使用 Amazon S3 等服务是否更明智?您对这种方法有何看法?在 Heroku 上托管静态文件有哪些选项?

最佳答案

回答你的问题,Heroku 的“临时文件系统”不会用作静态上传的存储。 Heroku 是一个应用程序服务器。您必须插入其他地方的数据存储。

来自 Heroku 的 spec :

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.

关于ruby-on-rails - Heroku - 为我的项目托管文件和静态文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31843709/

相关文章:

ruby-on-rails - Rails 3.2 + Heroku + S3 + CloudFront : Not serving gzip css js

ruby-on-rails - Rails Heroku 部署错误 - 推送被拒绝

ruby-on-rails - cancan & rolify 与 Multi-Tenancy 架构

ruby-on-rails - ActiveJob delivery_later无法发送

ruby-on-rails - 迁移到 Rails 3.2.1 后关系 "translations"不存在

javascript - Heroku 上的 WebSocket ERR_CONNECTION_REFUSED

java - postgres服务器拒绝连接到heroku

ruby-on-rails - 使用 Ruby on Rails 进行高性能 RSS/Atom 解析

mysql - Ruby on Rails add_column 不会将该列添加到现有行

json - 在 Heroku 上使用 Node 读取、写入和存储 JSON