Question

I wanted to deploy my local Rails app (that works perfectly) to Heroku, but get the following error message:

rake aborted!
could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
/tmp/build_21pkcz898c28o/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:1216:in `initialize'

Followed by many lines about postgres_adapter.

I'm a bit disappointed because I red that Heroku overwrite config/database.yml so why does it talk about running the server on 127.0.0.1 (I'm not looking for remote db)?

Thanks,

Update

If this can help, running heroku config gives the following:

DATABASE_URL:               xxx
HEROKU_POSTGRESQL_GRAY_URL: xxx (the same xxx as above)
Was it helpful?

Solution

Include the following in your application.rb, above the Module Appname

config.assets.initialize_on_precompile = false

And read the Heroku Labs: user-env-compile Article

OTHER TIPS

I am using Rails 4.0.4 and none of the above worked for me.

Following the heroku documentation

RAILS_ENV=production bundle exec rake assets:precompile

then

git add public/assets
git commit -m "vendor compiled assets"

Resolved it partially for me ... I could 'git push heroku master' but then my Bootstrap styling is not applied.

To resolve this final part, I added the recommended 'rails_12factor' gem in my gemfile.

group :production do
  gem 'thin'
  gem 'rails_12factor'
end

And all worked fine after that after my git push

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top