在windows上开发,在heroku上运行独角兽 [英] Develop on windows, run unicorn in production on heroku

查看:177
本文介绍了在windows上开发,在heroku上运行独角兽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个新的Rails项目,我决定给Heroku一个尝试,部署似乎很容易在那里



我在windows上开发,所以运行独角兽不是但是webrick对于开发很好



但是,当部署时,我想使用独角兽,而且heroku完全支持这个



问题是:我必须在我的Gemfile上列出独角兽,以便让heroku选择它,但是当我这样做并在Windows开发机器上运行bundle命令(或rails s)时,它会尝试安装独角兽服务器



我试图把独角兽放入制作组中,
group:production do
gem'unicorn'
end
仍捆绑抱怨,我无法运行开发服务器

解决方案

您可以在Gemfile中定位特定平台:

 平台:ruby do#linux 
gem'独角兽'
结束

平台:mswin做
#gems特有的风ows
end

请参阅 manpages for gemfile 获取更多信息。

I have a new Rails project and i decided to give heroku a try, deployment seems very easy there

I am developing on windows, so running unicorn is not a choice, but webrick is fine for development

BUT, when it come to deployment , i want to use unicorn, and heroku perfectly support this

The Problem Is: i have to list unicorn on my Gemfile in order for heroku to pick it, but when i do that and run bundle command (or rails s) on my windows dev machine, it tries to install the unicorn server

i tried to put unicorn in the production group, group :production do gem 'unicorn' end still bundle complain and i cannot run the dev server

解决方案

You can target specific platforms in your Gemfile:

platforms :ruby do # linux
  gem 'unicorn'
end

platforms :mswin do
  # gems specific to windows
end

see the manpages for gemfile for more information.

这篇关于在windows上开发,在heroku上运行独角兽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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