且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

“未加载 postgresql gem"在 Heroku 上部署 Ruby on Rails 应用程序时出错

更新时间:2022-12-21 23:33:37

在你的 Gemfile

group :production do
  gem 'pg'
end

然后运行 ​​bundle install 并尝试在 Heroku 上部署.

Then run bundle install and try to deploy on Heroku.

如果您想在所有环境中使用 PostgreSQL 而不仅仅是在 production(推荐)中,请在 :production 组之外添加 gem 并删除其他数据库适配器,例如 sqlite.

If you want to use PostgreSQL on all environments and not only in production (recommended) add the gem outside the :production group and remove other database adapters such as sqlite.

作为旁注,您可能还想添加 rails_12factor Heroku 建议的 gem.

As a side note, you may also want to add the rails_12factor gem as suggested by Heroku.