在生产机器上运行的导轨

发布于 2024-11-18 07:22:07 字数 1177 浏览 5 评论 0原文

我有一台机器,我的所有 Rails 应用程序都在“临时”环境中运行,甚至是生产环境。它正在尝试连接到临时数据库。我尝试在以下位置将其设置为生产:

#/etc/apache2/mods-enabled/passenger.so: 
# the line above was wrong, it is in /etc/apache2/sites-enabled/ier

RailsBaseURI /ier
RailsEnv production
<Directory /rails/production/ier/current/public>
  Options -MultiViews
</Directory>

#app/controllers/application_controller.rb
Rails.env = 'production'

我什至尝试将其放入:

#config/environment.rb adding Rails.env = 'production'

我收到乘客错误:

staging database is not configured (ActiveRecord::AdapterNotSpecified)

我什至运行(grep -R“staging”.in)并得到:

Binary file ./.git/index matches
./config/deploy.rb:set :stages, %w(staging production)
./config/deploy.rb:#    %w{staging.rb}.each do |config|
./config/deploy.rb:#    %w{production.rb staging.rb}.each do |deploy_env|
./config/database.yml:staging:
grep: ./config/deploy/staging.rb: No such file or directory
grep: ./config/deploy/production.rb: No such file or directory

我正在运行Apache2,Passenger 3.0.7、ruby 1.9.2 和 Rails 3.0.9

我还可以在哪里查找将环境设置为暂存的位置?

感谢您的帮助

I have a machine where all my rails apps are running in a "staging" environment, even the production ones. It is trying to connect to the staging database. I have tried setting it set to production in the following places:

#/etc/apache2/mods-enabled/passenger.so: 
# the line above was wrong, it is in /etc/apache2/sites-enabled/ier

RailsBaseURI /ier
RailsEnv production
<Directory /rails/production/ier/current/public>
  Options -MultiViews
</Directory>

#app/controllers/application_controller.rb
Rails.env = 'production'

I even tried putting it in:

#config/environment.rb adding Rails.env = 'production'

I am getting a passenger error of:

staging database is not configured (ActiveRecord::AdapterNotSpecified)

I even ran ( grep -R "staging" . in ) and got:

Binary file ./.git/index matches
./config/deploy.rb:set :stages, %w(staging production)
./config/deploy.rb:#    %w{staging.rb}.each do |config|
./config/deploy.rb:#    %w{production.rb staging.rb}.each do |deploy_env|
./config/database.yml:staging:
grep: ./config/deploy/staging.rb: No such file or directory
grep: ./config/deploy/production.rb: No such file or directory

I am running Apache2, Passenger 3.0.7, ruby 1.9.2, and rails 3.0.9

Where else can I look to find out where I set the environment to staging?

thanks for any help

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

李白 2024-11-25 07:22:07

尝试将其放入您的 配置中(可能在 /etc/apache2/site-enabled/000-default 中)。

RailsEnv production
RackEnv production

我听说 Passenger 的某些版本需要 RackEnv 而不是 RailsEnv,因此您可能想特别尝试一下。

如果您将 AllowOverride 设置为 OptionsAll.htaccess 文件中代码>.

Try putting this inside your <VirtualHost> configuration (probably in /etc/apache2/site-enabled/000-default).

RailsEnv production
RackEnv production

I hear some versions of Passenger required RackEnv instead of RailsEnv so you might want to try that especially.

You can also try putting it in an .htaccess file in your public directory if you have AllowOverride set to Options or All.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文