rails 控制台工作但 rails 服务器不工作
rails console works but rails server not working
您好,我正在 运行 解决一个对我来说没有意义的问题。
在我的托管服务器上,我有一个 rails 应用程序,我想 运行。我可以使用 capistrano 很好地部署应用程序。我也可以 运行 bundle exec rails console production
没有任何问题。但是,当我尝试 运行 bundle exec rails server
时,它退出并出现以下错误。
/home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/connection_specification.rb:52:in `resolve_hash_connection': database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified)
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/connection_specification.rb:46:in `resolve_string_connection'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/connection_specification.rb:30:in `spec'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/connection_handling.rb:39:in `establish_connection'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/railtie.rb:176:in `block (2 levels) in <class:Railtie>'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:44:in `each'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/base.rb:322:in `<module:ActiveRecord>'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/base.rb:22:in `<top (required)>'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/devise-3.2.4/lib/devise/orm/active_record.rb:3:in `<top (required)>'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
from /home/asavale1/rails_apps/dejalearn/releases/20150110214352/config/initializers/devise.rb:22:in `block in <top (required)>'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/devise-3.2.4/lib/devise.rb:288:in `setup'
from /home/asavale1/rails_apps/dejalearn/releases/20150110214352/config/initializers/devise.rb:3:in `<top (required)>'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `block in load'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/engine.rb:609:in `block (2 levels) in <class:Engine>'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/engine.rb:608:in `each'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/engine.rb:608:in `block in <class:Engine>'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `instance_exec'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `run'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:418:in `block (2 levels) in each_strongly_connected_component_from'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:417:in `block in each_strongly_connected_component_from'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:44:in `each'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:44:in `tsort_each_child'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:411:in `call'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:411:in `each_strongly_connected_component_from'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `each'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `call'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:54:in `run_initializers'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/application.rb:215:in `initialize!'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/asavale1/rails_apps/dejalearn/releases/20150110214352/config/environment.rb:5:in `<top (required)>'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
from /home/asavale1/rails_apps/dejalearn/releases/20150110214352/config.ru:3:in `block in <main>'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from /home/asavale1/rails_apps/dejalearn/releases/20150110214352/config.ru:in `new'
from /home/asavale1/rails_apps/dejalearn/releases/20150110214352/config.ru:in `<main>'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/commands/server.rb:48:in `app'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/commands/server.rb:75:in `start'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:76:in `block in <top (required)>'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `tap'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
所以它似乎不喜欢我的 database.yml
文件。这是我的 database.yml
production:
adapter: mysql2
database: asavale1_dejalearn
username: ENV['DB_USER']
password: ENV['DB_PASS']
pool: 5
timeout: 5000
为什么我可以 运行 bundle exec rails console production
但是当我尝试 运行 我的 rails 服务器时它抱怨适配器。他们两个不都使用同一个 databse.yml
文件来连接数据库吗?我的 RAILS_ENV
正在生产。
谢谢
您似乎在生产环境中显式启动控制台,在(默认)开发环境中显式启动服务器。尝试 运行 bundle exec rails server -e $RAILS_ENV
。如果这不起作用,请尝试 bundle exec rails server -e production
.
您好,我正在 运行 解决一个对我来说没有意义的问题。
在我的托管服务器上,我有一个 rails 应用程序,我想 运行。我可以使用 capistrano 很好地部署应用程序。我也可以 运行 bundle exec rails console production
没有任何问题。但是,当我尝试 运行 bundle exec rails server
时,它退出并出现以下错误。
/home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/connection_specification.rb:52:in `resolve_hash_connection': database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified)
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/connection_specification.rb:46:in `resolve_string_connection'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/connection_specification.rb:30:in `spec'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/connection_handling.rb:39:in `establish_connection'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/railtie.rb:176:in `block (2 levels) in <class:Railtie>'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:44:in `each'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/base.rb:322:in `<module:ActiveRecord>'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activerecord-4.0.2/lib/active_record/base.rb:22:in `<top (required)>'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/devise-3.2.4/lib/devise/orm/active_record.rb:3:in `<top (required)>'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
from /home/asavale1/rails_apps/dejalearn/releases/20150110214352/config/initializers/devise.rb:22:in `block in <top (required)>'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/devise-3.2.4/lib/devise.rb:288:in `setup'
from /home/asavale1/rails_apps/dejalearn/releases/20150110214352/config/initializers/devise.rb:3:in `<top (required)>'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `block in load'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/engine.rb:609:in `block (2 levels) in <class:Engine>'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/engine.rb:608:in `each'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/engine.rb:608:in `block in <class:Engine>'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `instance_exec'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `run'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:418:in `block (2 levels) in each_strongly_connected_component_from'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:417:in `block in each_strongly_connected_component_from'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:44:in `each'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:44:in `tsort_each_child'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:411:in `call'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:411:in `each_strongly_connected_component_from'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `each'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `call'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
from /home/asavale1/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:54:in `run_initializers'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/application.rb:215:in `initialize!'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/asavale1/rails_apps/dejalearn/releases/20150110214352/config/environment.rb:5:in `<top (required)>'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
from /home/asavale1/rails_apps/dejalearn/releases/20150110214352/config.ru:3:in `block in <main>'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from /home/asavale1/rails_apps/dejalearn/releases/20150110214352/config.ru:in `new'
from /home/asavale1/rails_apps/dejalearn/releases/20150110214352/config.ru:in `<main>'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/commands/server.rb:48:in `app'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/commands/server.rb:75:in `start'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:76:in `block in <top (required)>'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `tap'
from /home/asavale1/rails_apps/dejalearn/shared/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
所以它似乎不喜欢我的 database.yml
文件。这是我的 database.yml
production:
adapter: mysql2
database: asavale1_dejalearn
username: ENV['DB_USER']
password: ENV['DB_PASS']
pool: 5
timeout: 5000
为什么我可以 运行 bundle exec rails console production
但是当我尝试 运行 我的 rails 服务器时它抱怨适配器。他们两个不都使用同一个 databse.yml
文件来连接数据库吗?我的 RAILS_ENV
正在生产。
谢谢
您似乎在生产环境中显式启动控制台,在(默认)开发环境中显式启动服务器。尝试 运行 bundle exec rails server -e $RAILS_ENV
。如果这不起作用,请尝试 bundle exec rails server -e production
.