Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm having trouble changing an existing app with SQLite3 to postgreSQL. I'm following this tutorial to convert SQLite3 to postgreSQL and deploy it to heroku: https://devcenter.heroku.com/articles/sqlite3#running-rails-on-postgres.

I removed gem 'sqlite3' and replaced with gem 'pg'. After modifying config/database.yml, I ran migration.

$rake db:create and $rake db:migrate resulted this error:

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 used in production:

gem 'rails_12factor'
gem 'thin'
gem 'pg'

Following is the errors I get when I run with the local server:

/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"?
share|improve this question
1  
Read the error message. Did you check the things it's telling you to check? Did you search for the error message? I'll bet you're probably on a Mac, too, in which case add "OS X" to that search, because it's a v.common issue for Mac users of PostgreSQL + Rails. Hard to help more because you didn't include your PostgreSQL version or how you installed PostgreSQL, or your OS and version. –  Craig Ringer Jan 16 at 7:53
add comment

1 Answer 1

It looks like you have not added a Heroku Postgres database to your Heroku account. When a database is configured, your application will connect to it. Without a database configured, it's falling back to looking for one locally.

If you do have a database configured, something is wrong with your Heroku environment preventing your database connection settings from being found.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.