问题
I have a rails app which runs a service which has no assets. When I deploy, I see:
-----> 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'
...
So I put this into my application.rb:
config.assets.enabled = false
config.serve_static_assets = false
config.assets.compile = false
But I still get the very same message when deploying.
How can I completely turn off asset compilation/handling on heroku?
回答1:
See this question and the docs. It looks like the magic occurs in the manifest.yml
file.
回答2:
Found this on https://devcenter.heroku.com/articles/rails-asset-pipeline
While precompiling assets, in Rails 3.x, you can prevent initializing your application and connecting to the database by ensuring that the following line is in your config/application.rb
:
config.assets.initialize_on_precompile = false
来源:https://stackoverflow.com/questions/17845889/how-can-i-turn-off-asset-compilation-completely-on-a-rails-app-on-heroku