【发布时间】:2014-08-20 06:07:09
【问题描述】:
问题描述:
有两个项目,一个是主项目,另一个项目是timesheet_app。 我想将 timeheet_app 挂载到主项目。
当访问 url http://localhost:3000/tsheet/base 时,它说
“Sinatra 不知道这首歌”
Try this:
# in app.rb
class Qiankun::App
get '/tsheet/base' do
"Hello World"
end
end
这是控制台输出
DEBUG - 20/Aug/2014 14:15:22 GET (0.0870s) /tsheet/base - 404 Not Found
DEVEL - 20/Aug/2014 14:15:22 Reloading application TimesheetApp::App
DEVEL - 20/Aug/2014 14:15:22 Reloading application TimesheetApp::App
DEVEL - 20/Aug/2014 14:15:22 Reloading application TimesheetApp::Tsheet
DEVEL - 20/Aug/2014 14:15:22 Reloading application TimesheetApp::Tsheet
DEBUG - 20/Aug/2014 14:15:22 GET (0.1120s) /tsheet/__sinatra__/404.png -
04 Not Modified
在timesheet_app self中,运行“padrino start”后,访问http://localhost:3000/base is ok.。
在主项目中,检查“rake routes”,找到另一个项目的url“tsheet/base”就在那里。
(:base, :index) GET /tsheet/base
下面是一些mount相关的代码
在主项目apps.rb中
Padrino.mount('TimesheetApp::App', :app_file => TimesheetApp.root('app/app.rb')).to('/time_sheet')
Padrino.mount('TimesheetApp::Tsheet', :app_file => TimesheetApp.root('tsheet/app.rb')).to("/tsheet")
在主项目 gemfile 中
gem 'timesheet_app',:path=>"d:\\IdeaLab\\timesheet_app",:require=>"timesheet_app"
这是控制器代码,很简单
TimesheetApp::Tsheet.controllers :base do
enable :reload
get :index do
"hello , tsheet!"
end
end
有什么想法吗?可能是 padrino 框架中的错误?
padrino 版本 0.12.3
【问题讨论】: