2
我越來越想開始我的項目鐵軌控制檯時此錯誤:無法啓動生產鋼軌控制檯
/home/username/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:47:in `resolve_hash_connection': database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified)
from /home/username/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:41:in `resolve_string_connection'
from /home/username/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:25:in `spec'
from /home/username/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:129:in `establish_connection'
from /home/username/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.8/lib/active_record/railtie.rb:82:in `block (2 levels) in <class:Railtie>'
from /home/username/.rvm/gems/ruby-1.9.3-p362/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
from /home/username/.rvm/gems/ruby-1.9.3-p362/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /home/username/.rvm/gems/ruby-1.9.3-p362/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
from /home/username/.rvm/gems/ruby-1.9.3-p362/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:42:in `each'
from /home/username/.rvm/gems/ruby-1.9.3-p362/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
from /home/username/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.8/lib/active_record/base.rb:721:in `<top (required)>'
from /home/username/.rvm/gems/ruby-1.9.3-p362/gems/activerecord-3.2.8/lib/active_record/railtie.rb:41:in `block in <class:Railtie>'
from /home/username/.rvm/gems/ruby-1.9.3-p362/gems/railties-3.2.8/lib/rails/railtie.rb:179:in `call'
from /home/username/.rvm/gems/ruby-1.9.3-p362/gems/railties-3.2.8/lib/rails/railtie.rb:179:in `block in load_console'
from /home/username/.rvm/gems/ruby-1.9.3-p362/gems/railties-3.2.8/lib/rails/railtie.rb:179:in `each'
from /home/username/.rvm/gems/ruby-1.9.3-p362/gems/railties-3.2.8/lib/rails/railtie.rb:179:in `load_console'
from /home/username/.rvm/gems/ruby-1.9.3-p362/gems/railties-3.2.8/lib/rails/engine.rb:429:in `block in load_console'
from /home/username/.rvm/gems/ruby-1.9.3-p362/gems/railties-3.2.8/lib/rails/application/railties.rb:8:in `each'
from /home/username/.rvm/gems/ruby-1.9.3-p362/gems/railties-3.2.8/lib/rails/application/railties.rb:8:in `all'
from /home/username/.rvm/gems/ruby-1.9.3-p362/gems/railties-3.2.8/lib/rails/engine.rb:429:in `load_console'
from /home/username/.rvm/gems/ruby-1.9.3-p362/gems/railties-3.2.8/lib/rails/application.rb:153:in `load_console'
from /home/username/.rvm/gems/ruby-1.9.3-p362/gems/railties-3.2.8/lib/rails/commands/console.rb:27:in `start'
from /home/username/.rvm/gems/ruby-1.9.3-p362/gems/railties-3.2.8/lib/rails/commands/console.rb:8:in `start'
from /home/username/.rvm/gems/ruby-1.9.3-p362/gems/railties-3.2.8/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
這裏是我的database.yml文件(從默認的一個未修改):
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
我不相信這是一個系統特定的問題,因爲它在我的開發環境(Fedora的17檯筆記本電腦)和生產環境(Debian的6 VPS)發生兩。在VPS上,nginx +獨角獸開始並且在生產中沒有問題地服務。原因可能是什麼?
如果您想使用製作環境,請嘗試使用'RAILS_END = production rails c'。 – Reactormonk
這是RAILS_ENV,錯字。 我通常會把'export RAILS_ENV = production'放到.bashrc中。 – Ineu