JamesRocky
JamesRocky

Reputation: 721

Heroku: PG::ConnectionBad: could not connect to server: Connection refused

I tried pushing new app to heroku and go this error PG::ConnectionBad: could not connect to server: Connection refused

This is my gemfile, does it have to do with that? I'm using spree with postgress. I'm not sure since this is the first time I've tried using spree in heroku but it doesn't seem to be going through. Any help would be appreciated

source 'https://rubygems.org'

ruby "2.2.1"

gem 'puma', '~> 2.13.4'
gem 'braintree', '~> 2.48.1'
gem 'rails', '4.2.3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc

group :development, :test do
  gem 'byebug'
  gem 'web-console', '~> 2.0'
  gem 'spring'
end

    group :production, :staging do
        gem 'pg'
        gem 'rails_12factor', '~> 0.0.3'
    end


gem 'spree', '3.0.4'
gem 'spree_gateway', github: 'spree/spree_gateway', branch: '3-0-stable'
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '3-0-stable'

database.yml

default: &default
  adapter: postgresql
  encoding: unicode
  pool: 5

development:
  <<: *default
  host: localhost
  database: ****
  username: **** 
  password: ****

test:
  <<: *default
  host: localhost
  database: ****
  username: **** 
  password: ****

production:
  <<: *default
  database: ****
  username: ****
  password: <%= ENV['DATABASE_PASSWORD'] %>

Upvotes: 5

Views: 6210

Answers (1)

K M Rakibul Islam
K M Rakibul Islam

Reputation: 34338

In your application.rb file, try setting this:

config.assets.initialize_on_precompile = false

and see if that fixes your issue.

Also, if you already did not pre-provision the database for your app, you need to create one:

heroku addons:create heroku-postgresql

You can verify the database was added to your application by running:

heroku config --app your_app_name

Upvotes: 15

Related Questions