Reputation: 901
I'm pushing changes to Heroku and I get ...
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?
When I consult the Heroku documentation Here, it tells me I need to "configure a nonexistent database in your local config/database.yml" I'm not sure how to create a "nonexistent database"? I'm a beginner and would appreciate any help you can give me. Thanks.
Upvotes: 13
Views: 3064
Reputation: 24392
On Heroku, you must set this line in your config/application.rb:
config.assets.initialize_on_precompile = false
http://guides.rubyonrails.org/asset_pipeline.html#precompiling-assets
For faster asset precompiles, you can partially load your application by setting config.assets.initialize_on_precompile to false in config/application.rb, though in that case templates cannot see application objects or methods. Heroku requires this to be false.
Upvotes: 29
Reputation: 61
I ran into the same problem. It seems that for some reason the DATABASE_URL environment variable is not set at the time of asset precompilation. A workaround is to set the DATABASE_URL in the production.rb file.
ENV["DATABASE_URL"] = <your db url>
That should fix the problem.
Upvotes: 0
Reputation: 4992
It means put in the name of a database that doesn't actually exist in your local dev environment. Then try and run rake assets:precompile
You're simulating the same scenario locally (an unavailable db).
Are you using Devise in this app? It had a known issue similar to this. You may want to update that gem.
Upvotes: 0