【发布时间】:2019-04-29 15:10:48
【问题描述】:
当我运行heroku run rails db:migrate 时,我得到一个错误:
PG::ConnectionBad: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
/app/vendor/bundle/ruby/2.6.0/gems/pg-1.1.4/lib/pg.rb:56:in `initialize'
/app/vendor/bundle/ruby/2.6.0/gems/pg-1.1.4/lib/pg.rb:56:in `new'
/app/vendor/bundle/ruby/2.6.0/gems/pg-1.1.4/lib/pg.rb:56:in `connect'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:692:in `connect'
我已经安装了pg gem。这是我的配置:
# database.yml
production:
adapter: postgresql
encoding: unicode
# For details on connection pooling, see Rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
database: bigbig-fishfish_production
username: bigbig-fishfish
password: <%= ENV['MYAPP_DATABASE_PASSWORD'] %>
我做的有什么明显错误的吗?为什么我会收到错误消息?
【问题讨论】: