2013-05-02 49 views
0

某些項目資產是ERB(如file.js.coffee.erb),它會從數據庫中提取數據以便自行編寫。數據庫表似乎已經創建好了,但Heroku一直在預編譯時停止這樣的錯誤:Heroku中止rake:需要數據庫訪問時的預編譯

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? 

好吧,好的。我在Heroku Devcenter中尋找幫助,發現an article解釋這實際上是由於環境中缺乏配置變量而發生的。因此,指令是運行:

env RAILS_ENV=production DATABASE_URL=scheme://user:[email protected]/dbname bundle exec rake assets:precompile 2>&1 

於是我運行命令與適當的替代品,從Heroku的tollbelt (Heroku的運行...),外放postgresqlscheme,也填補userpass,和dbname字段正確。一,話又說回來:

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? 

    (in /app/app/assets/javascripts/file.js.coffee.erb)/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/postgresql_adapter.rb:1208:in `initialize' 

好像我是suposed使用從Heroku的自動化數據庫配置一些真實的信息,但我只是不知道那些是什麼配置。

我有點卡住了。任何人都可以伸出援助之手?

非常感謝!

+0

那麼,我通過在本地設置生產環境來進行管理,預編譯,然後將其推送到Heroku。到現在爲止還挺好。 – 2013-05-02 23:21:16

回答

相關問題