问题描述
当我运行我的rails应用程序在生产模式图像不显示和css不工作
在我的控制台我得到消息
ActionController :: RoutingError(没有路由匹配/ stylesheets /theme.css):
Rendered C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues / layout(0.0ms)
,但在我的视图/布局application.html.erb中包括<%= stylesheet_link_tag'theme'%> 和theme.css config / production.rb 中进行以下更改:
更改:
config.serve_static_assets = false
至:
config.serve_static_assets = true
这将解决它,我保证
when i run my rails application in production mode images are not displayed and css is not workingin my console i got the messageActionController::RoutingError (No route matches "/stylesheets/theme.css"):Rendered C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.0ms)but in my view/layout application.html.erb i included the line <%= stylesheet_link_tag 'theme' %> and theme.css is present in the public/stylesheet folder
make the following change in config/production.rb
change:
config.serve_static_assets = false
to:
config.serve_static_assets = true
That will fix it, I guarantee
这篇关于rails应用程序不会在production-environment中加载css / js / images的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!