如何在environment.rb或initializer内强制RAILS_ENV =开发? [英] How do I force RAILS_ENV=development from within environment.rb or initializers?

查看:116
本文介绍了如何在environment.rb或initializer内强制RAILS_ENV =开发?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的主机不允许我们修改乘客配置文件(即apache配置或vhosts文件),但是我们希望在dev模式下运行rails。因此,我们必须在rails加载的文件之一中指定环境(prod / dev / test),因为应用程序重新启动。任何人都知道如何做到这一点?

Our host does not allow us to modify the passenger config file (i.e. the apache config OR the vhosts file), but we'd like to run rails in dev mode. So we have to specify the environment (prod/dev/test) in one of the files that rails loads AS the application is restarted. Anyone know how to do this?

我们尝试过没有运气的以下内容:

We've tried the following with no luck:

#environment.rb (before any other code is executed)
  `RAILS_ENV=development`          # using back ticks
  ENV['RAILS_ENV'] = 'development' # assigning to a constant
  RAILS_ENV='development'          # as suggested by one of the answers, unfortunately does not work.


推荐答案

为什么不更改你的production.rb配置以匹配在development.rb中找到的设置?

Why don't you change your production.rb config to match the settings found in development.rb?

这篇关于如何在environment.rb或initializer内强制RAILS_ENV =开发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆