I used 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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.