[英]Where am I going wrong? “undefined method 'application' for Sinatra:Module” Sinatra/Passenger/Apache
I'm trying to get my first Sinatra app off the ground, but am getting an error page from Passenger: 我正在尝试启动我的第一个Sinatra应用程序,但是从Passenger中得到了一个错误页面:
undefined method `application' for Sinatra:Module
Here's my Rackup file: 这是我的Rackup文件:
require 'rubygems'
require 'sinatra'
set :env, :production
disable :run
require 'app'
run Sinatra.application
And the app itself: 应用本身:
#!/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}!"
Where am I going wrong? 我要去哪里错了?
here's mine config.ru 这是我的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
also, my app code lives in application.rb 另外,我的应用程序代码位于application.rb中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.