pip install pydblite
pip install web.py
python
import web
import pydblite
urls = (
'/', 'index',
'/show', 'show_students'
)
app = web.application(urls, globals())
db = pydblite.Base('students.db')
db.create('name', 'age')
class index:
def GET(self):
return """
<form action="/" method="POST">
</form>
"""
def POST(self):
data = web.input()
db.insert(name=data.name, age=data.age)
raise web.seeother('/show')
class show_students:
def GET(self):
students = db()
if __name__ == '__main__':
app.run()