7

看起来这是一个常见问题,所以让我先说我已经做了很多研究。

按照这个线程,我跑了

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

然后我通过运行确保资产在本地预编译

RAILS_ENV=production bundle exec rake assets:precompile

他们是这样。

我也遵循了这个提示,设置

config.assets.initialize_on_precompile = false

在我的 config/production.rb 和 config/application.rb 中。

此外,在这个问题之后,我确保我安装了 heroku gem:

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

然后我bin通过遵循这个 heroku 文章来确保我已经走上了自己的道路。

然后我确保我遵循了 heroku 上的“Rails 4.xx 入门”文章

我还关注了这个问题的另一个答案,并将以下内容放入application.rbproduction.rb

config.serve_static_assets = true

这是我在运行时遇到的错误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?

似乎config.assets.initialize_on_precompile = false应该可以工作,因为它似乎在预编译期间尝试加载生产数据库。

我已经进行了所有这些更改,并且它们已被推送到 master in git. 现在我应该尝试什么?

4

1 回答 1

3

好吧,对不起。我想我没有推动RAILS_ENV=production bundle exec rake assets:precompile. 希望这可以作为解决此问题的大量资源。

编辑

为了做到这一点,我跑了RAILS_ENV=production bundle exec rake assets:precompile. 然后我犯了这个

git add -A
git commit -m "precompiled assets"
git push origin master
git push heroku master
于 2013-06-10T01:28:25.260 回答