I'm getting "Heroku push rejected, no Rails or Rack app detected" error w/ Sinatra app
I use开发者_Go百科d the example hello world app here:
http://devcenter.heroku.com/articles/rack
And get the error "Heroku push rejected, no Rails or Rack app detected" Help?
You are missing a config.ru
file. What you want to do is to create a file that looks like this: (it should be in the root of your repo)
# config.ru
require './your/app/file'
run MyApp
...where MyApp
is your Sinatra app's class.
Be sure that your app file will not try to start (MyApp.run!
) your app when require'd:
# your_app_file.rb
class MyApp < Sinatra::Base
...
end
# Only run it when called as `ruby your_app_file.rb`
MyApp.run! if $0 == __FILE__
Make sure you have these lines in your Gemfile
source 'http://rubygems.org'
gem 'sinatra'
Then:
bundle
Then:
git push heroku master
This happened to me. It turned out it was because I initialized the Git repository in myproject/myapp/. Heroku needs the Git repository to be in myapp/. I deleted the .git folder in myproject/ (thus deleting that repository) and ran
cd myapp
git init
After that, it worked great.
精彩评论