Tried several fixes: Heroku/Rails 4 Assets Precompile Error

Looks like this is a common issue, so let me begin by saying I've done a lot of research already.

Following this thread, I ran

heroku labs:enable user-env-compile -a myapp

Then I made sure that assets precompile locally by running

RAILS_ENV=production bundle exec rake assets:precompile

They do.

I also followed this tip, setting

config.assets.initialize_on_precompile = false

in my config/production.rb and config/application.rb.

Also, following this issue, I've made sure I have the heroku gems installed:

gem 'rails_log_stdout',           github: 'heroku/rails_log_stdout'
gem 'rails3_serve_static_assets', github: 'heroku/rails3_serve_static_assets'

Then I made sure I had bin in my path by following this heroku article.

Then I made sure I followed the "Getting Started with Rails 4.xx" article on heroku.

I've also followed another answer to this question and placed the following in application.rb and production.rb

config.serve_static_assets = true

Here's the error I get when running git push heroku master :

   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?

It seems like config.assets.initialize_on_precompile = false should've worked, because it seems like it's trying to load the production database during precompliation.

I've made all these changes and they've been pushed to master in git . Now what should I try?


Well, sorry about this. I guess I hadn't pushed the effects of RAILS_ENV=production bundle exec rake assets:precompile . Hopefully this serves as a number of resources for this issue.

Edit

In order to do this, I ran RAILS_ENV=production bundle exec rake assets:precompile . Then I committed this with

git add -A
git commit -m "precompiled assets"
git push origin master
git push heroku master
链接地址: http://www.djcxy.com/p/14044.html

上一篇: Android中的摄像机意图和优先级队列

下一篇: 尝试了几个修正:Heroku / Rails 4资产预编译错误