Ruby 我哪里做错了&引用;未定义的方法';应用程序';对于Sinatra:模块“;西纳特拉/乘客/阿帕奇

Ruby 我哪里做错了&引用;未定义的方法';应用程序';对于Sinatra:模块“;西纳特拉/乘客/阿帕奇,ruby,apache,sinatra,passenger,Ruby,Apache,Sinatra,Passenger,我正在尝试启动我的第一个Sinatra应用程序,但收到乘客的错误页面: undefined method `application' for Sinatra:Module 这是我的档案: require 'rubygems' require 'sinatra' set :env, :production disable :run require 'app' run Sinatra.application 以及应用程序本身: #!/usr/bin/env ruby require 'rub

我正在尝试启动我的第一个Sinatra应用程序,但收到乘客的错误页面:

undefined method `application' for Sinatra:Module
这是我的档案:

require 'rubygems'
require 'sinatra'
set :env,  :production
disable :run
require 'app'
run Sinatra.application
以及应用程序本身:

#!/usr/bin/env ruby

require 'rubygems'
require 'sinatra'
require 'haml'

get '/' do
  haml :index
end

get '/hello/:name' do |name|
  @name = name
  haml :hello
end

get '/goodbye/:name' do |name|
  haml :goodbye, :locals => {:name => name}
end

__END__

@@layout
%html
  %head
    %title hello.dev
  %body
    =yield

@@index
#header
  %h1 hello.dev
#content
  %p
    This is a test...

@@hello
%h1= "Hello #{@name}!"

@@goodbye
%h1= "Goodbye #{name}!"

我哪里出错了?

这是我的config.ru

require 'application'

set :run, false
set :environment, :production

FileUtils.mkdir_p 'log' unless File.exists?('log')
log = File.new("log/sinatra.log", "a")
$stdout.reopen(log)
$stderr.reopen(log)

run Sinatra::Application

另外,我的应用程序代码保存在application.rb中,这里是我的config.ru

require 'application'

set :run, false
set :environment, :production

FileUtils.mkdir_p 'log' unless File.exists?('log')
log = File.new("log/sinatra.log", "a")
$stdout.reopen(log)
$stderr.reopen(log)

run Sinatra::Application
此外,我的应用程序代码位于application.rb中