我有一个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上完全关闭资产编译/处理?
答案 0 :(得分:3)
请参阅this question和the docs。看起来好像发生在manifest.yml
文件中。
答案 1 :(得分:2)
在https://devcenter.heroku.com/articles/rails-asset-pipeline
上找到了这个在预编译资产时,在Rails 3.x中,您可以通过确保config/application.rb
中包含以下行来阻止初始化您的应用程序并连接到数据库:
config.assets.initialize_on_precompile = false