Rails生成服务器样式表未加载

时间:2014-01-12 02:25:47

标签: ruby-on-rails nginx unicorn

我在轨道图像上使用数字海洋红宝石,它有nginx和独角兽。我捆绑了我的项目bundle install,然后service unicorn restart,但它似乎没有加载。我前一段时间遇到过这个问题并使用bundle exec ...解决了这个问题,但我无法记住完整的命令。我看到了一些与此类似的问题并尝试bundle exec rake assets:precompile以及编辑production.rb(Why "rails server -e production" makes it "No route matches "/" and stylesheet not loading?)文件,但它不起作用。我正在寻找通过命令而不是通过代码执行此操作的解决方案。

编辑:bundle exec rake assets:precompile做了一些工作!问题是我创建了一个名为main.css的额外css文件,它不导入,但其他一切都有效!

1 个答案:

答案 0 :(得分:2)

使用RAILS_ENV=production rake assets:precompileRAILS_ENV=production指定运行rake任务的环境。