我目前的问题与本帖子中描述的完全相同:Rails not serving assets in production or staging environments。未在Windows上投入生产的Rails 4资产
我在Windows 7的生产环境中运行Rails 4.0.4(所以很容易成为问题,不能很好地使用Linux)。我运行了rake assets:clobber
以确保所有内容都已清理完毕,然后RAILS_ENV=production rake assets:precompile
,并成功完成,没有错误或警告。所有的文件出现在我的公共/资产文件夹中,并使用Windows资源管理器,我可以查看application.js和application.css中的文本,并正确显示图像。但是,当我尝试访问localhost:3001/assets/application.js时,它与application.css相同,并且图像文件出现错误。每次更改设置和预编译后,我都重新启动了服务器。
当我看着日志说它的页面呈现成功,没有像我在其他帖子中看到的“没有路由匹配”的错误。所以资产被发现,但由于某种原因,他们没有得到适当的服务。
这里是我的production.rb:
ABC::Application.configure do
config.cache_classes = true
config.eager_load = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.action_dispatch.x_sendfile_header = "X-Sendfile"
config.serve_static_assets = true
config.action_mailer.default_url_options = { :host => '' }
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
config.assets.js_compressor = :uglifier
config.assets.css_compressor = :sass
config.assets.compile = false
config.assets.digest = true
end
任何帮助将不胜感激,我一直停留在这近两天!