$ pip install pydblite $ pip install web.py python import web from pydblite import Base python urls = ( '/', 'index', '/add', 'add_item', ) app = web.application(urls, globals()) render = web.template.render('templates/') python mydb = Base('mydatabase.pdl') if not mydb.exists(): mydb.create('name', 'age') python class index: def GET(self): items = mydb return render.index(items) class add_item: def POST(self): data = web.input() mydb.insert(name=data.name, age=data.age) return web.seeother('/') python if __name__ == "__main__": app.run()


上一篇:
下一篇:
切换中文