ruby-on-rails - 部署到 heroku 时出错:rake Assets :预编译 PG::ConnectionBad:无法连接到服务器:连接被拒绝

标签 ruby-on-rails git heroku deployment

在尝试将应用程序 git push 到 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

我的 Assets 在本地编译,无需连接到数据库。

我还添加了 config.assets.initialize_on_precompile = false

但是在heroku中尝试部署时仍然出现错误...

知道我做错了什么吗?

谢谢!

P.S: 我正在使用带有 rails 4.2.0 的 spree 3.0.0

最佳答案

在 heroku 中为您的应用创建新的数据库: heroku 插件:创建 heroku-postgresql

然后试试 git push 到 heroku

关于ruby-on-rails - 部署到 heroku 时出错:rake Assets :预编译 PG::ConnectionBad:无法连接到服务器:连接被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29306082/

相关文章:

git - Heroku:如何在 Heroku 上更改 Git 远程

django - 使用退出代码零调试 celery WorkerLostError(Heroku 上的 Django 1.5.5 + celery 3.1.8 + RabbitMQ 3.1.3)

ruby-on-rails - 如何为 Rabl 的集合分页

ruby-on-rails - pry 控制台中是否有类似 grep 的功能?

git - 使用 git filter-branch 删除除一个子目录之外的所有内容

mysql - 有没有一种方便的方法可以在我的 git 提交中包含一个 mysqldump?

node.js - 在多个 Node 上部署 socket.io 应用程序

Django 设置多个允许的主机

ruby-on-rails - 列出与 http 方法关联的所有 Rails 路线

ruby-on-rails - 如何使用 Ruby(on Rails) 计算两个地理位置之间的公路距离?