【发布时间】:2015-01-30 08:56:42
【问题描述】:
我有一个应用程序已启动到 heroku。在我的开发环境中,我的 CSS 背景加载正常。但是,我无法弄清楚为什么它没有加载到我的生产环境中。
body {
font-family: "Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;
background: url('letters.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
}
我阅读了一篇关于添加到我的 application.rb 文件的 heroku 文章:
config.assets.initialize_on_precompile = true
但是它说如果我有这个宝石,我不需要这样做:
gem 'rails_12factor'
是我的语法错误还是需要在别处添加一些代码?
【问题讨论】:
-
heroku 有错误吗?您可以通过使用带有 Javascript 控制台的 Chrome 来查看任何错误。
-
我检查了heroku日志,它说:ActionController::RoutingError (No route matches [GET] "/assets/letters.jpg"):
-
确认 Rails 版本(3 或 4),您应该看到 heroku doc(devcenter.heroku.com/articles/rails-asset-pipeline)。也许你应该在本地
reke assets:precompile,git add和git push heroku master。
标签: css ruby-on-rails heroku