ruby-on-rails – 为什么“rails server -e production”使它“
发布时间:2020-12-16 21:51:23 所属栏目:百科 来源:网络整理
导读:它正在运行Rails 3.0.0或Rails 3.0.5(使用 Ruby 1.9.2) 处于开发模式 rails server 那么http://localhost:3000的工作都很好,http://localhost:3000/foos将加载一个stylesheet.css 但是当它是 rails server -e production 那么现在突然,http://localhost:3000
它正在运行Rails 3.0.0或Rails 3.0.5(使用
Ruby 1.9.2)
处于开发模式 rails server 那么http://localhost:3000的工作都很好,http://localhost:3000/foos将加载一个stylesheet.css 但是当它是 rails server -e production 那么现在突然,http://localhost:3000给了: No route matches "/" 和http://localhost:3000/foos可以运行,但是stylesheet.css没有加载,并在浏览器中打开它显示: No route matches "/stylesheets/scaffold.css" 生产与发展需要特殊路线吗? (还是因为其他原因?) 解决方法
你需要设置
config.serve_static_assets = true 在config / environments / production.rb中.这可能已经在那里被注释了. 默认情况下,Rails在生产中不会自动提供静态文件,因为Nginx或Apache等完整的Web服务器将自动为它们提供服务. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |