服务器无法在 rails 3 生产环境中找到公用文件夹 [英] Server unable to find public folder in rails 3 production environment
问题描述
我使用的是最新的 rails 3 测试版.该应用程序在开发模式下运行良好,但是当我通过 rails server -e production
在生产模式下启动服务器时,似乎找不到 public
文件夹.我收到如下错误消息:
I'm using the latest rails 3 beta. The app works fine in development mode, but when I start the server in production mode via rails server -e production
, it seems that the public
folder can't be found. I get error messages like:
ActionController::RoutingError (No route matches "/javascripts/jquery.js"):
以及应该在 public
文件夹中的所有内容的类似消息.我已经用 mongrel 和 webrick 试过了.我很感激任何帮助.
And similar messages for everything that should be in the public
folder.
I've tried this with both mongrel and webrick. I'd appreciate any help.
推荐答案
编辑 config/environments/production.rb 并设置这一行:
editing config/environments/production.rb and setting this line:
config.serve_static_assets = true
config.serve_static_assets = true
这篇关于服务器无法在 rails 3 生产环境中找到公用文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!