21

Using postgres.
Haven't been able to push.

Tried this without any luck:

config.assets.initialize_on_precompile = false

-----> 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?
4

5 回答 5

38

接受的答案并没有完全解决这个问题。我试图找到一个解决方案 2-3 小时没有成功,然后这个工作:

在您的应用程序目录中。

heroku labs:enable user-env-compile

它仍然失败?

heroku labs:disable user-env-compile
heroku labs:enable user-env-compile

然后它对我有用,只需要删除并再做一次。

Rails 4 不再需要以下配置。编译资产必须在没有它的情况下工作。

config.assets.initialize_on_precompile = false
于 2013-06-20T10:05:44.457 回答
6

config.assets.initialize_on_precompile = false

将其包含在 application.rb 中,ABOVE 模块 APPNAME

我最初将它包含在里面

类应用程序 < Rails::应用程序

编辑:实际上,上面没有解决它。

我不得不这样做

https://devcenter.heroku.com/articles/labs-user-env-compile

于 2013-04-21T23:14:51.350 回答
1

尝试在本地执行

bundle exec rake assets:precompile RAILS_ENV=production

在我的情况下,这可能是因为设计了gem。您可能在设计初始化程序中缺少密钥。尝试添加

config.secret_key = "PROVIDE-KEY"
于 2014-03-01T09:34:31.300 回答
0

如果您使用的是 Rolify pre version 3.5,那么它可能是:

https://github.com/EppO/rolify/issues/221

于 2014-03-11T10:43:16.083 回答
0

heroku 开发中心讨论了如何解决这个问题。基本上,您的 rails4 应用程序不应依赖于在运行时存在配置变量。

https://devcenter.heroku.com/articles/rails-asset-pipeline#troubleshooting

于 2013-07-26T13:48:22.947 回答