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

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

谢谢你的帮助

4

1 回答 1

0

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

RailsEnv production
RackEnv production

我听说需要一些版本的乘客,RackEnv而不是RailsEnv所以你可能想特别尝试一下。

如果您已设置为或,您也可以尝试将其放入.htaccess公共目录中的文件中。AllowOverrideOptionsAll

于 2011-07-02T06:51:55.643 回答