url映射###
先構(gòu)造一個url和類的映射元組
urls=('/index','index',
'/blog/\d+','blog',
'/(.*)', 'hello')
在下面構(gòu)造對應(yīng)的類,如
class index():
def GET(self):
return 'index'
框架內(nèi)部會把映射元組轉(zhuǎn)換為包含多個由url和類名組成的列表的列表。
請求處理###
web.input()%獲取請求參數(shù)
web.ctx.env%獲取請求頭
響應(yīng)處理###
render=web.template.render('templates')%設(shè)定模板文件夾
render.index("參數(shù)")%模板文件讀取
model.select("sql")%結(jié)果數(shù)據(jù)獲取
web.seeother("相對路徑或絕對路徑")%URL跳轉(zhuǎn)