8

我想将我的本地 Rails 应用程序(完美运行)部署到 Heroku,但收到以下错误消息:

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?
/tmp/build_21pkcz898c28o/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:1216:in `initialize'

后面有很多关于postgres_adapter.

我有点失望,因为我认为 Heroku 会覆盖config/database.yml那么为什么它会谈论在其上运行服务器127.0.0.1(我不是在寻找远程数据库)?

谢谢,

更新

如果这有帮助,运行heroku config会提供以下信息:

DATABASE_URL:               xxx
HEROKU_POSTGRESQL_GRAY_URL: xxx (the same xxx as above)
4

2 回答 2

11

在您的 application.rb 中包含以下内容,位于 Module Appname 上方

config.assets.initialize_on_precompile = false

并阅读Heroku 实验室:user-env-compile文章

于 2013-08-29T06:09:46.190 回答
0

我正在使用 Rails 4.0.4,但以上都不适合我。

遵循heroku文档

RAILS_ENV=production bundle exec rake assets:precompile

然后

git add public/assets
git commit -m "vendor compiled assets"

为我解决了部分问题......我可以'git push heroku master',但我的引导样式没有应用。

为了解决这最后一部分,我在我的 gemfile 中添加了推荐的“rails_12factor”gem。

group :production do
  gem 'thin'
  gem 'rails_12factor'
end

在我的 git push 之后一切正常

于 2014-03-20T00:17:51.067 回答