Ruby on Rails的:如何设置其开发环境的应用程序运行在? [英] Ruby on Rails: How to set which development environment an app runs in?
问题描述
我是比较新的Ruby on Rails的,偶尔我觉得这个约定优于配置的东西有点混乱,因为很多东西似乎是从开发人员隐藏,因为在这种情况下。
I'm relatively new to Ruby on Rails and occasionally I find this convention-over-configuration stuff a little confusing as a lot of things seemed to be hidden from the developer, as in this case.
我使用的铁轨2.3.8,当我通过我的系统上的NetBeans 6.9 /杂种本地运行我的应用程序运行使用的开发环境参数..当我把它部署到Fedora的框,并在有apache httpd的运行它会自动运行使用生产环境参数。
I'm using rails 2.3.8 and when I run my app locally through NetBeans 6.9/Mongrel on my system it runs using the development environment parameters.. when I deploy it to a Fedora box and run it there in Apache HTTPD it automatically runs using the production environment parameters.
怎么我的应用程序知道使用哪种环境?我没有在我的应用程序改变任何东西在本地设置环境..两个版本和我的Fedora箱是相同的。我不能在code在那里设置环境的任何地方发现..所以这是怎么工作?
How does my app know which environment to use? I haven't changed anything in my app to set the environment.. both versions locally and on my Fedora box are identical. I can't find anywhere in the code where it is setting the environment.. so how is this working?
感谢。
推荐答案
在httpd.conf文件,写入虚拟主机如下: -
In httpd.conf file, write the following in VirtualHost:-
##指定Rails环境在这里,
默认值是生产结果
RailsEnv发展
## Specify Rails Environment here, default value is "production"
RailsEnv development
谢谢...
这篇关于Ruby on Rails的:如何设置其开发环境的应用程序运行在?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!