Check this article about Heroku and Rails asset:precompile error. You should set
config.assets.initialize_on_precompile = false
Question
Note: I am using Rails 3.2.13 and Ruby "1.9.3", and postgres-0.15.1
I tried to push my Ruby on Rails app in to heroku by following the procedure this website http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#sec-deploying , but I got error while try to push into heroku
Connecting to database specified by DATABASE_URL 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?
! Precompiling assets failed.
! Push rejected, failed to compile Ruby app
To git@heroku.com:pure-hamlet-9148.git
! [remote rejected] master -> master (pre-receive hook declined)
So, I Googled myself and run the below command
heroku labs:disable user-env-compile heroku labs:enable user-env-compile
Still getting the same error, please some help me to resolve this issue.
Solution 2
Check this article about Heroku and Rails asset:precompile error. You should set
config.assets.initialize_on_precompile = false
OTHER TIPS
Along with Simone's answer,
Follow this website to precompile your assets locally before deploying. https://devcenter.heroku.com/articles/rails-asset-pipeline
RAILS_ENV=production bundle exec rake assets:precompile
git add public/assets -f
git commit -m "vendor compiled assets"
A way to resolve this error: First of all set DATABASE_URL environment variable & then again tried to push code to Heroku again. And it worked as all rake compilation done at Heroku side so no more connection to local machine making rake compilation @ .../tmp/bin..... directory.