2
我一直在试图得到一个简单的Hello World世界网络应用程序在Sinatra上运行。如何使用ruby1.9部署机架应用程序?
我有以下设置:
config.ru
require 'hello.rb' run Sinatra::Application
hello.rb的
require "sinatra" get "/" do "Hello World!\n" end
的Gemfile
source :rubygems gem 'sinatra'
,如果我跑ruby hello.rb
,ruby1.9.1 hello.rb
或rackup
并转到正确的地址在我的浏览器这个作品在我的本地机器上。但是,在部署到heroku或运行rackup1.9.1
时,这不起作用。我收到以下错误:
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- hello.rb (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from config.ru:1:in `block in <main>'
from /usr/lib/ruby/1.9.1/rack/builder.rb:46:in `instance_eval'
from /usr/lib/ruby/1.9.1/rack/builder.rb:46:in `initialize'
from config.ru:1:in `new'
from config.ru:1:in `<main>'
from /usr/lib/ruby/1.9.1/rack/builder.rb:35:in `eval'
from /usr/lib/ruby/1.9.1/rack/builder.rb:35:in `parse_file'
from /usr/lib/ruby/1.9.1/rack/server.rb:113:in `app'
from /usr/lib/ruby/1.9.1/rack/server.rb:189:in `wrapped_app'
from /usr/lib/ruby/1.9.1/rack/server.rb:155:in `start'
from /usr/lib/ruby/1.9.1/rack/server.rb:83:in `start'
from /usr/bin/rackup1.9.1:4:in `<main>'
我该如何得到这个工作?我猜config.ru应该是不同的,但我不知道要改变什么。