4
我在使用SQLite3將現有應用程序更改爲postgreSQL時遇到問題。我正在學習本教程將SQLite3轉換爲postgreSQL並將其部署到heroku:https://devcenter.heroku.com/articles/sqlite3#running-rails-on-postgres。Rails 4 Heroku postgreSQL錯誤
我刪除了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"?
閱讀錯誤消息。你檢查了它告訴你檢查的東西嗎?您是否搜索錯誤消息?我敢打賭你也可能在Mac上,在這種情況下,爲該搜索添加「OS X」,因爲這是PostgreSQL + Rails的Mac用戶的v.common問題。很難幫助更多,因爲*您沒有包含PostgreSQL版本,或者您如何安裝PostgreSQL,或者您的操作系統和版本*。 –