rails应用程序不会在生产环境中加载css / js / images

问题描述 投票:3回答:1

当我在生产模式下运行我的rails应用程序时,图像不会显示而css在我的控制台中无法正常工作我收到消息ActionController :: RoutingError(没有路由匹配“/stylesheets/theme.css”):呈现C:/ Ruby192 / lib /ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb救援/布局(0.0ms)但在我的视图/布局application.html.erb我包含行<%= stylesheet_link_tag'主题'%> ,theme.css出现在public / stylesheet文件夹中

css ruby-on-rails-3 production-environment
1个回答
5
投票

config / production.rb中进行以下更改

更改:

config.serve_static_assets = false

至:

config.serve_static_assets = true

我保证会解决这个问题

© www.soinside.com 2019 - 2024. All rights reserved.