开发者

No Such File To Load Passenger and Sinatra

I've recently updated to Ruby 1.9.2 (RVM), Sinatra 1.1 and Passenger 3.0.0. I have a simple application composed of:

# config.ru

require 'rubygems'
require 'sinatra'
require 'app.rb'

run Sinatra::Application

# app.rb

require 'rubygems'
require 'sinatra'

get '/' do
  erb :index
end

If I run the application from the terminal using ru开发者_JAVA技巧by app.rb everythign launches as expected. However, with Passenger I get: no such file to load -- app.rb. I have other Rails applications running fine with the setup, and have setup the document root to a sub public directory. Any ideas how to fix this? Thanks!


I had the same problem here:

# config.ru

require 'rubygems'
require 'sinatra'

require File.dirname(__FILE__) + "/app.rb"

run Sinatra::Application


Managed to fix the issue. Figured out for some reason the config.ru requires the include to be specified relative to the current directory. The modified file is:

# config.ru

require 'rubygems'
require 'sinatra'
require './app.rb'

run Sinatra::Application
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜