1

我们已将 Rails 1.9.3 应用程序部署到生产 Windows 2008 R2s Server。[客户端坚持使用 IIS :-(]。我们使用 Helicon Zoo,在 IIS 管理器中设置站点,将应用程序复制到默认目录,然后运行:

  • 捆绑安装
  • bundle exec rake assets:precompile
  • 耙分贝:设置 RAILS_ENV="生产"

我们能够在本地和远程连接,但有两个问题。

1) CSS 样式表不可用,页面格式(不足为奇)是垃圾。日志显示以下内容:

Started GET "/assets/application-af54c6f2f95c6c2f7d965706cab068f3.css" for 10.10.100.185 at 2013-09-16 17:02:27 -0400

 ActionController::RoutingError (No route matches [GET] "/assets/application-af54c6f2f95c6c2f7d965706cab068f3.css"):
  actionpack (3.2.13) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  ...

但是,在 public/assets 目录中有一个名为“application-af54c6f2f95c6c2f7d965706cab068f3.css”的文件。是什么赋予了?

2)在开发中工作的路由和生产中的WEBrick中断。这是一个例子:

查看代码:<%= link_to 'Logout', logout_path, method: :delete %>

路线代码:

controller :sessions do
  get    'login'  => :new
  post   'login'  => :create
  delete 'logout' => :destroy
  post   'logout' => :create
end

日志:

Started GET "/logout" for 10.10.100.185 at 2013-09-16 17:04:20 -0400

ActionController::RoutingError (No route matches [GET] "/logout"):
  actionpack (3.2.13) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  ...

当控制器指示“method: :delete”时为什么要[Get]?为什么它在 dev 中有效,但在 prod 中无效?

4

1 回答 1

0

两者都在驱使您解决路由问题。

  • 首先确保您没有assets控制器。
  • 然后一定要对路线有很好的了解。有关于 的 好文章
  • 检查环境配置文件之间的差异
  • 考虑阅读或查看配置Rails 指南

我知道这只是一条检查线,但这有助于专注于正确的点。

于 2013-09-16T22:48:22.120 回答