在生产机器上运行的导轨
我有一台机器,我的所有 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试将其放入您的
配置中(可能在/etc/apache2/site-enabled/000-default
中)。我听说 Passenger 的某些版本需要
RackEnv
而不是RailsEnv
,因此您可能想特别尝试一下。如果您将
AllowOverride
设置为Options
或All.htaccess
文件中代码>.Try putting this inside your
<VirtualHost>
configuration (probably in/etc/apache2/site-enabled/000-default
).I hear some versions of Passenger required
RackEnv
instead ofRailsEnv
so you might want to try that especially.You can also try putting it in an
.htaccess
file in your public directory if you haveAllowOverride
set toOptions
orAll
.