部署到Heroku时出现错误:rake assets:precompile PG :: ConnectionBad:无法连接到服务器:拒绝连接

3
当我尝试将应用程序推送到Heroku时,出现了以下特定错误:
remote:        Running: rake assets:precompile 
remote:        PG::ConnectionBad: could not connect to server: Connection     refused
remote:        Is the server running on host "127.0.0.1" and accepting
remote:        TCP/IP connections on port 5432?

我尝试按照这篇文章的步骤进行操作:https://devcenter.heroku.com/articles/rails-asset-pipeline#troubleshooting。在不需要连接到数据库的情况下,我的资产已经成功编译了。
我还添加了config.assets.initialize_on_precompile = false。但是在尝试在heroku中部署时仍然会出现错误...
您有什么关于我做错了什么的想法吗?
谢谢!
附言:我正在使用spree 3.0.0和rails 4.2.0。

也许您添加config.assets.initialize_on_precompile = false后忘记了将更改提交到git。 - vitdes
你的Gemfile在生产环境中加载了什么? - Elvn
1个回答

8
在Heroku为您的应用程序创建新的数据库: heroku addons:create heroku-postgresql 然后尝试将代码推送到Heroku。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接