Heroku Rails 4无法连接到服务器:连接被拒绝

使用postgres。
一直无法推动。

没有任何运气试过这个:

config.assets.initialize_on_precompile = false 

—–>为Rails资产管道准备应用程序

  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? 

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

在您的app目录中。

 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 

config.assets.initialize_on_precompile = false

在application.rb中包含ABOVE模块APPNAME

我最初把它包含在里面

class Application

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

我不得不这样做

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

尝试在本地执行

 bundle exec rake assets:precompile RAILS_ENV=production 

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

 config.secret_key = "PROVIDE-KEY" 

heroku开发中心谈论对此进行故障排除。 基本上你的rails4应用程序不应该依赖于在运行时存在配置变量。

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

如果您使用的是Rolify 3.5之前的版本,则可能是:

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