将一个子目录部署到Heroku [英] Deploy a subdirectory to 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
出现以下错误:
I get the following error:
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屋!