python db.define_table('user', Field('username', requires=IS_NOT_EMPTY()), Field('email', requires=IS_EMAIL()), Field('password', 'password'), format='%(username)s') python db.user.insert(username='John', email='john@example.com', password='password') python rows = db(db.user.username == 'John').select() python db(db.user.username == 'John').update(email='new-email@example.com') python db(db.user.username == 'John').delete() python def index(): message = 'Hello World' return dict(message=message) html <!DOCTYPE html> <html> <head> <title>Web2py Template</title> </head> <body> <h1>{{=message}}</h1> </body> </html> python python web2py.py -a 'password' nginx location / { uwsgi_pass 127.0.0.1:8001; include uwsgi_params; uwsgi_param UWSGI_PYHOME /path/to/web2py; uwsgi_param UWSGI_CHDIR /path/to/web2py; uwsgi_param UWSGI_SCRIPT wsgihandler; }


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