wang_rx 发表于 2017-4-26 11:33:29

python web.py研究

python越来越火,都上升到编程语言第8了,闲来无事看看能有啥用,就选择了web.py研究下,顺便做个笔记,免得以后忘记了

一个简单例子:

import web,os
from web.contrib.template import render_jinja
import hessianUtil
import json
urls = (
'/home', 'home'
)

app_root=os.path.dirname(__file__)
templates_path=os.path.join(app_root,'templates').replace("\\","/")
render = render_jinja(
templates_path,   # 设置模板路径.
encoding = 'utf-8', # 编码.
)

class home:      
def GET(self):
return render.home({})

app=web.application(urls,globals())
if __name__ == "__main__":
app.run()
页: [1]
查看完整版本: python web.py研究