1

我在生產模式下部署應用程序,但是當我嘗試完成該過程時,顯示了對sqlite適配器的這種需求,請有人知道如何制止這個問題?如何停止安裝sqlite3適配器:服務器上的`gem install activerecord-sqlite3-adapter`

我一直在使用RAILS_ENV =生產,但在這種情況下沒有奏效。

current$ rails generate admin_interface:setup RAILS_ENV=production 
DEPRECATION WARNING: Support for Rails < 4.1.0 will be dropped. (called from warn at /home/ubuntu/.rbenv/versions/2.2.2/lib/ruby/2.2.0/forwardable.rb:183) 
/home/ubuntu/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/rubygems_integration.rb:322:in `block in replace_gem': Please install the sqlite3 adapter: `gem install activerecord-sqlite3-adapter` (sqlite3 is not part of the bundle. Add it to Gemfile.) (LoadError) 
    from /home/ubuntu/vitrineonline/releases/10/vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/sqlite3_adapter.rb:3:in `<top (required)>' 
    from /home/ubuntu/vitrineonline/releases/10/vendor/bundle/ruby/2.2.0/gems/backports-3.6.8/lib/backports/std_lib.rb:9:in `require' 
    from /home/ubuntu/vitrineonline/releases/10/vendor/bundle/ruby/2.2.0/gems/backports-3.6.8/lib/backports/std_lib.rb:9:in `require_with_backports' 
    from /home/ubuntu/vitrineonline/releases/10/vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:251:in `block in require' 
    from /home/ubuntu/vitrineonline/releases/10/vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:236:in `load_dependency' 
    from /home/ubuntu/vitrineonline/releases/10/vendor/bundle/ruby/2.2.0/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:251:in `require' 
    from /home/ubuntu/vitrineonline/releases/10/vendor/bundle/ruby/2.2.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/connection_specification.rb:50:in `resolve_hash_connection' 

回答

0

第一個問題,我看到的是,你應該把RAILS_ENV聲明在你的命令的開始,因爲這個設置指令的生活該變量。

RAILS_ENV=production bundle exec rails generate admin_interface:setup 

這可能是完全根本原因。 (還要注意使用bundle exec可以肯定的是,在Gemfile中指定的寶石被正確加載)

如果你想將其設置爲外殼,運行:

export RAILS_ENV=production 

所以你不必爲每個命令手動設置它。

第二種可能性是數據庫適配器沒有正確配置。如果這是一個Ruby on Rails應用程序,則數據庫適配器在config/database.yml中定義。如果沒有指定,它可能默認爲sqlite3。確保你有一個正確設置的database.yml文件。

production: 
    adapter: postgresql 
    database: rails4_stack 
    username: myusername 
    password: mypassword 
    pool: 5 
    timeout: 5000 
    encoding: utf8 
    reconnect: false 
+0

非常感謝。 – jjplack

相關問題