【发布时间】:2014-01-25 20:49:14
【问题描述】:
我是 Rails 4.0 的新手。当我推动 heroku Cedar 堆栈时,我不了解预编译过程。我这样做:
$> rake assests:precompile
$> git add .
$> git commit -m "foobar" && git push && git push heroku
似乎一切正常,但我的图像/css 似乎没有在 heroku 应用程序上“加载”(Chrome)(但在本地完美运行):
Failed to load resource: the server responded with a status of 404 (Not Found) http://xxxapp.herokuapp.com/stylesheets/bootstrap.min.css
我尝试了一些方法,但我听说这不是好的解决方案。我已修改config/environments/production.rb 文件并更改:
config.assets.compile = false
到
config.assets.compile = true
它工作正常,我所有的图像和 css 都已加载,但我想我错过了一些东西。
还有
我试过了:
$> rm -rf public/assets
$> git add .
$> git commit -m "foooo" && git push && git push heroku
预编译过程运行良好,但之后,我的应用程序上仍然没有加载图像和 css。
通过添加编辑我的 Gemfile 后:
group :production do
gem 'rails_12factor'
end
图片加载良好,但没有 css..
【问题讨论】:
标签: ruby-on-rails heroku assets precompile