【发布时间】:2013-09-26 09:24:52
【问题描述】:
我正在尝试设置我的应用程序以通过 Amazon S3/Cloudfront CDN 提供资产。它是一个 Rails 应用程序,我使用 asset_sync gem 按照 this heroku document. 实现这一目标@
我将我的项目推送到heroku,然后运行heroku run rake assets:precompile。这给了我如下所示的输出:
I, [2013-09-20T21:19:06.506796 #2] INFO -- : Writing /app/public/assets/application-cb6347d3ce9380e02c37364b541fd8ae.js
I, [2013-09-20T21:19:19.979570 #2] INFO -- : Writing /app/public/assets/application-9dc3068c1bf9290c7eb0493fd36b3587.css
[WARNING] fog: followed redirect to abc123.s3-us-west-1.amazonaws.com, connecting to the matching region will be more performant
[WARNING] fog: followed redirect to abc123.s3-us-west-1.amazonaws.com, connecting to the matching region will be more performant
请注意,它为 JS 文件 cb6347d3ce9380e02c37364b541fd8ae.js 写入的哈希值是正确的(因为我也在 localhost 下的 staging 中运行了它)。
但问题是,当我在 heroku 上点击我的应用并检查源代码时,它包含的 JS 50460076f4c6eb614a44b6b17323efa7.js 与之前编译的不同...
为什么 heroku 没有选择正确的预编译资产来使用?我在本地部署并执行了所有相同的步骤,我的本地服务器毫无问题地选择了正确的 JS。
感谢您的帮助!
【问题讨论】:
标签: heroku ruby-on-rails-4 asset-pipeline amazon-cloudfront