服务器在rails 3生产环境中找不到公用文件夹

发布于 2024-09-01 00:28:52 字数 316 浏览 1 评论 0原文

我正在使用最新的 Rails 3 beta。该应用程序在开发模式下运行良好,但是当我通过rails server -e production 在生产模式下启动服务器时,似乎找不到public 文件夹。我收到如下错误消息:

ActionController::RoutingError (No route matches "/javascripts/jquery.js"):

对于应该位于 public 文件夹中的所有内容,我都会收到类似的消息。 我已经用 mongrel 和 webrick 尝试过了。我将不胜感激任何帮助。

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"):

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

扛起拖把扫天下 2024-09-08 00:28:52

编辑 config/environments/production.rb 并设置此行:

config.serve_static_assets = true

editing config/environments/production.rb and setting this line:

config.serve_static_assets = true

灯角 2024-09-08 00:28:52

nginx、unicorn 和 apache 会自动执行此操作。如果您使用这些服务器进行部署,请务必将其更改回 false。

nginx, unicorn and apache will do this automatically. be sure to change this back to false if you are deploying using these servers.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文