Rails和Postgres - 在部署heroku时忽略pg gem [英] Rails and postgres - pg gem ignored during deploy on heroku

查看:106
本文介绍了Rails和Postgres - 在部署heroku时忽略pg gem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用上部署heroku时遇到问题。我已经给Gemfile添加了'pg'gem,甚至尝试添加诸如gem'therubyracer-heroku'之类的东西。
期间

  heroku rake db:migrate 

我得到这样的东西:

 > heroku rake db:migrate 
--trace
**调用db:migrate(first_time)
**调用环境(first_time)
**执行环境
rake中止!
请安装postgresql适配器:`gem install activerecord-postgresql-adap
ter`(pg不是bundle的一部分,将它添加到Gemfile中)
/app/.bundle/gems /ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connectio
n_adapters / abstract / connection_specification.rb:71:在`rescue in establish_conne
ction'

另一个有趣的部分是,在捆绑安装操作期间未提及heroku pg,就像忽略它一样。我也看过Gemfile.lock和pg在那里提到:

  pg(0.11.0-x86-mingw32)

我不知道这是否是导致heroku忽略pg gem或什么的Windows gem问题?



任何人都可以帮忙或者有类似的问题吗?

//编辑

似乎相关:在此处输入链接描述

并且看起来难以解决

postgres to your production group;

  group:production do 
gempg
end

重新绑定

  bundle  - 没有生产

并提交到git(Gemfile和Gemfile.lock)并推送到Heroku 。这应该可以解决你的问题。


I have trouble deploying my app on heroku. I have added 'pg' gem to Gemfile, and even try to include something like gem 'therubyracer-heroku'. during

heroku rake db:migrate

I get something like this:

>heroku rake db:migrate
 --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
Please install the postgresql adapter: `gem install activerecord-postgresql-adap
ter` (pg is not part of the bundle. Add it to Gemfile.)
/app/.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.1/lib/active_record/connectio
n_adapters/abstract/connection_specification.rb:71:in `rescue in establish_conne
ction'

Another interesting part is that while pushing to heroku pg is not mentioned during bundle install operation like if it was ignored. I also watched the Gemfile.lock and pg is mentioned there to:

pg (0.11.0-x86-mingw32)

I wonder if it is a Windows gem issue that cause heroku to ignore the pg gem or something ?

Can anyone help or had similar problem ?

//EDIT

Seems related: enter link description here

And looks unsolveable

解决方案

In your Gemfile limit postgres to your production group;

group :production do
  gem "pg"
end

rebundle

bundle --without production

and commit to git (Gemfile and Gemfile.lock) and push to Heroku. That should solve your problem.

这篇关于Rails和Postgres - 在部署heroku时忽略pg gem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆