【发布时间】:2019-05-31 17:26:18
【问题描述】:
我使用的是 Rails 5.2.3,当我尝试在 Heroku 管道上查看我的生产应用程序时遇到应用程序错误,并且在以下情况下出现以下错误:
我运行
heroku logs我得到:heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/"我运行
heroku run rails console我得到:Error loading the 'sqlite3' Active Record adapter. Missing a gem it depends on? sqlite3 is not part of the bundle. Add it to your Gemfile. (LoadError)我运行
heroku run rails db:migrate我得到:LoadError: Error loading the 'sqlite3' Active Record adapter. Missing a gem it depends on? sqlite3 is not part of the bundle. Add it to your Gemfile.
我想使用 sqlite3 进行开发,使用 postgres 进行生产,那么为什么我需要让 sqlite3 gemfile 在生产模式下可用?
这是我的 gemfile:
group :development do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
这是我的 database.yml:
default: &default
adapter: sqlite3
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
development:
<<: *default
database: db/development.sqlite3
test:
<<: *default
database: db/test.sqlite3
production:
<<: *default
database: db/production.sqlite3
【问题讨论】:
标签: ruby-on-rails postgresql sqlite heroku