pip install web2py python -m web2py.app.appname python web2py.py -a yourpassword -p 8000 python db = DAL('sqlite://storage.db') db.define_table('person', Field('name')) db.person.insert(name='John') rows = db(db.person).select() html <html> <body> <h1>Hello {{=name}}!</h1> </body> </html> python def index(): name = 'John' return dict(name=name) python from gluon.tools import Auth auth = Auth(db) auth.define_tables(username=True) def login(): form = auth.login() def restricted_area(): if not auth.user: redirect(URL('login')) return dict() python @request.restful() def api(): def GET(*args, **vars): return dict(message="Hello from API!") return locals()


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