无法部署到Heroku,因为服务器拒绝连接
我想将我的本地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)
在您的application.rb中包含以下内容,位于Module Appname上方
config.assets.initialize_on_precompile = false
阅读Heroku Labs:user-env-compile文章
我正在使用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’但是我的Bootstrap样式没有应用。
为了解决这个最后的部分,我在我的gemfile中添加了推荐的’rails_12factor’gem。
group :production do gem 'thin' gem 'rails_12factor' end
在我的git推动之后,所有工作都很好