Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
448 views
in Technique[技术] by (71.8m points)

ruby on rails - Deploy a subdirectory to 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.

How do I deploy a subdirectory to Heroku?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...