我在将SQLite3的现有应用程序更改为postgreSQL时遇到问题。我遵循本教程将SQLite3转换为postgreSQL并将其部署到heroku:https://devcenter.heroku.com/articles/sqlite3#running-rails-on-postgres。
我去掉了gem 'sqlite3‘,代之以gem 'pg’。在修改config/database.yml之后,我运行了迁移。
$rake db:create和$rake db:migrate导致此错误:
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?生产中使用的Gemfile:
gem 'rails_12factor'
gem 'thin'
gem 'pg'以下是我在本地服务器上运行时得到的错误:
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:825:in `initialize': could not connect to server: No such file or directory (PG::ConnectionBad)
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?发布于 2014-01-16 23:35:07
看起来你还没有将Heroku Postgres数据库添加到你的Heroku帐户。配置数据库后,您的应用程序将连接到该数据库。如果没有配置数据库,它将退回到本地查找数据库。
如果您配置了数据库,则说明Heroku环境有问题,无法找到您的数据库连接设置。
https://stackoverflow.com/questions/21154821
复制相似问题