如何在environment.rb或initializer内强制RAILS

编程入门 行业动态 更新时间:2024-10-24 08:24:01
本文介绍了如何在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

本文发布于:2023-10-28 13:30:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1536770.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何在   environment   rb   initializer   RAILS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!