将子目录部署到 Heroku [英] Deploy a subdirectory to Heroku

查看:33
本文介绍了将子目录部署到 Heroku的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 GitHub 中有一个超级"存储库,其中包含我想部署到 Heroku 的几个应用程序.这是我的存储库的示例.

I have one 'super' repository in GitHub which will contain several applications I would like to deploy to Heroku. Here is an example of my repository.

/app
  /.git
  /website <-- would like to deploy this to Heroku

当我尝试使用以下命令推送时:

When I try to push using the following command:

$ git push heroku master

我收到以下错误:

Heroku push rejected, no Rails or Rack app detected.

如何将子目录部署到 Heroku?

How do I deploy a subdirectory to Heroku?

推荐答案

这可以通过在你的根目录中放置一个 config.ru 来完成,告诉 Heroku 在哪里可以找到你的应用程序.例如,对于 Rails 3,在你的根目录中尝试像这样的 config.ru:

This can be accomplished by putting a config.ru in your root directory that tells Heroku where to find your app. For example, with Rails 3, try a config.ru like this in your root directory:

WEBSITE_SUBDIR = 'website'
require "#{WEBSITE_SUBDIR}/config/environment"
run YourApplicationName::Application

在 Rails 2.x 上,你需要这样的东西:

And on Rails 2.x, you'll need something like this:

WEBSITE_SUBDIR = 'website'
require "#{WEBSITE_SUBDIR}/config/environment"
use Rails::Rack::LogTailer
use Rails::Rack::Static
run ActionController::Dispatcher.new

这篇关于将子目录部署到 Heroku的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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