2013-07-24 46 views
4

我有一個rails應用程序,它運行的服務沒有資產。當我部署,我看到:如何在Heroku上的Rails應用程序中完全關閉資產編譯?

-----> 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? 
     /tmp/build_3pneyggcg60ks/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgresql_adapter.rb:1222:in `initialize' 
     /tmp/build_3pneyggcg60ks/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgresql_adapter.rb:1222:in `new' 
     /tmp/build_3pneyggcg60ks/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgresql_adapter.rb:1222:in `connect' 
... 

所以我要把它放到我的application.rb中:

config.assets.enabled = false 
config.serve_static_assets = false 
config.assets.compile = false 

但我在部署時仍然得到了同樣的消息。

如何完全關閉heroku上的資產編譯/處理?

回答

2

發現這對https://devcenter.heroku.com/articles/rails-asset-pipeline

雖然預編譯的資產,在Rails的3.x中,可以防止初始化你的應用程序,並通過確保下面一行是在連接到數據庫中的config/application.rb

config.assets.initialize_on_precompile = false 
+0

只控制預編譯時是否應用程序初始化,而不管它是否首先進行預編譯。 –

+0

嗯,但現在我看看接受的答案,也許你的建議也將與我的配置一起工作,因爲我的配置實際上會被拾起? –

相關問題