简体   繁体   English

在webrick服务器上的生产模式下运行rails

[英]Running rails on a Production mode in webrick server

In my current ruby on rails project, I am using webrick (default) server for development. 在我目前的ruby on rails项目中,我使用webrick(默认)服务器进行开发。 I have a separate server for testing the application and I want to set the environment to Products in it. 我有一个单独的服务器来测试应用程序,我想将环境设置为其中的产品。 I used the following line to run the server in production mode. 我使用以下行在生产模式下运行服务器。

rails s -e production

The issue is, it works perfectly if its in the development mode, but in server mode I'm getting following error: 问题是,如果它处于开发模式,它可以正常工作,但在服务器模式下,我遇到以下错误:

Started GET "/" for 172.20.7.94 at Thu Jun 07 10:35:45 +0530 2012
  Processing by FrontendController#dashboard as HTML
Rendered frontend/dashboard.html.erb within layouts/frontend (3.0ms)
Completed 200 OK in 50ms (Views: 22.0ms | ActiveRecord: 0.0ms)


Started GET "/assets/frontend-datauri.css" for 172.20.7.94 at Thu Jun 07 10:35:4
6 +0530 2012
  Processing by Jammit::Controller#package as HTML
  Parameters: {"extension"=>"css", "package"=>"frontend-datauri"}
Completed 500 Internal Server Error in 190ms

NameError (uninitialized constant POpen4::Open4):


Started GET "/assets/frontend.js" for 172.20.7.94 at Thu Jun 07 10:35:46 +0530 2
012
  Processing by Jammit::Controller#package as
  Parameters: {"extension"=>"js", "package"=>"frontend"}
Completed 500 Internal Server Error in 105ms

NameError (uninitialized constant POpen4::Open4):

I am using Jammit and POpen4 and my rails version is: 3.0.9. 我使用Jammit和POpen4,我的rails版本是:3.0.9。 Ruby version 1.8.7. Ruby版本1.8.7。 I can't currently upgrade the version as several other developers are involved in the project. 我目前无法升级该版本,因为其他几个开发人员都参与了该项目。 Can anybody give me a solution for this. 任何人都可以给我一个解决方案。

Thanks 谢谢

Thanks a lot for everyone who tried to help me regarding this issue. 非常感谢那些试图帮助我解决这个问题的人。 I installed CentOS and everything's have fixed and running smoothly. 我安装了CentOS,一切都已修复并顺利运行。

That might be some issue with the Windows server 2008 which I was using previously 这可能是我之前使用的Windows Server 2008的一些问题

Thanks a lot 非常感谢

The best practice is to specify your dependencies in your Gemfile. 最佳做法是在Gemfile中指定依赖项。

Gemfile: 的Gemfile:

...
gem 'popen4'
...

and then run bundle install to create a specific bundle of gems for your app. 然后运行bundle install以为您的应用创建特定的gem。

Otherwise your app relies on what you have installed locally on your machine (I suppose via gem install popen4 ). 否则,您的应用程序依赖于您在计算机上本地安装的内容(我想通过gem install popen4 )。

Here you production machine doesn't have the gem POpen4 installed on it... So the other quick (but no recommended) solution is to install the gem manually on your production machine with gem install popen4 . 在这里,您的生产机器上没有安装宝石POpen4 ......所以另一个快速(但没有推荐)的解决方案是使用gem install popen4在您的生产机器上手动安装宝石。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM