因此,我花了一天的時間閱讀每個SO問題,甚至是溫和相關的,並檢查了Heroku文檔。Rails 4和Heroku - rake資產:預編譯嘗試調用Postgres
這是推動當Heroku的問題:
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
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?
我敢肯定,這是熟悉的。
很多東西在Rails 4上的Heroku部署中發生了變化我知道,但我甚至嘗試了很多4.0以前的建議來嘗試修復它。
它:
/tmp/build_22xpuyyrmltz6/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:825:in `initialize'
/tmp/build_22xpuyyrmltz6/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:825:in `new'
/tmp/build_22xpuyyrmltz6/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:825:in `connect'
/tmp/build_22xpuyyrmltz6/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:542:in `initialize'
/tmp/build_22xpuyyrmltz6/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `new'
/tmp/build_22xpuyyrmltz6/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `postgresql_connection'
等等......所以從我收集,這是因爲試圖在編譯時訪問數據庫。
我的問題至今是this question
RAILS_ENV=production bundle exec rake assets:precompile
運行抄送罰款和產生的manifest.json,但Heroku的不承認它。
我也試過這個,但我認爲Rails 4默認爲false。
config.assets.initialize_on_precompile = false
那麼接下來要解決此問題上下的事情,我很高興地嘗試是:
heroku labs:enable user-env-compile
和我想這是最,創造了新的Heroku應用程序,開啓和關閉並再次觸發它。嘗試多次推。我也在需要時進行提交,所以不是這樣。
也嘗試了rails_12factor和其他一些我不記得的東西。一切都無濟於事。
有什麼我失蹤了嗎?用戶環境編譯似乎在解決其他人的問題,但似乎對我沒有任何影響。
我甚至重新啓動了我的電腦幾次...任何幫助將不勝感激。
您可能有一些寶石嘗試在資產編譯期間訪問數據庫。你的路線文件中有'mount'語句嗎? – phoet
是的,掛載Sidekiq :: Web =>'/ sidekiq' 我認爲這是發生了什麼,最後我只是放棄了heroku。對於這些情況我覺得有點過分了。 – Willl