【问题标题】:Failed to connect to database - can't push PostgreSQL database to heroku无法连接到数据库 - 无法将 PostgreSQL 数据库推送到 heroku
【发布时间】:2013-04-05 07:33:55
【问题描述】:

我创建了一个非常简单的博客应用程序,其中包含几个条目,我想要做的只是将其推送到 heroku,但我收到以下错误:

$ heroku db:push [git@github.com:appname/blog.git]
Loaded Taps v0.3.24
Auto-detected local database: postgres://benjaminw@127.0.0.1/blog_development?en
coding=WIN1252
Warning: Data in the app 'afternoon-taiga-2755' will be overwritten and will not
be recoverable.

!    WARNING: Destructive Action
!    This command will affect the app: afternoon-taiga-2755
!    To proceed, type "afternoon-taiga-2755" or re-run this command with --conf
irm afternoon-taiga-2755

> afternoon-taiga-2755
Failed to connect to database:
Sequel::AdapterNotFound -> LoadError: cannot load such file -- pg

但是我已经安装了 pg gem 和 sequel gem。这是我的宝石文件。我排除了几行,因为它们被注释掉了。有人遇到过这个问题吗?

source 'https://rubygems.org'

gem 'rails', '3.2.13'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

 gem 'pg'
 gem 'activerecord-postgresql-adapter'
 gem 'sequel'


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

【问题讨论】:

  • Taps 不再是 heroku 推荐的方式,你试过了吗:devcenter.heroku.com/articles/heroku-postgres-import-export
  • 嗯...我会通读教程并试一试。谢谢
  • 好的,如果您有任何问题,请告诉我
  • config/database.yml 长什么样子?你有什么改变吗?
  • @pjam 我在我的应用程序的根目录文件夹中创建了一个 blog_development.dump 文件,我假设我需要使用 pgbackups:restore 来上传它。对吗……你能把这件事弄清楚一点吗?

标签: ruby-on-rails ruby ruby-on-rails-3 heroku postgresql-9.1


【解决方案1】:

我在使用 db:pull 时遇到了同样的问题。在确保我安装了所有的 gem 之后,它就可以工作了(帽子提示:heroku db:pull not working)。

gem install pg heroku taps sequel

【讨论】:

    猜你喜欢
    • 2014-03-30
    • 2013-04-19
    • 1970-01-01
    • 2017-11-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-30
    相关资源
    最近更新 更多