1.2.2.4 The easy way

If you just want to get up and running quickly web.auth.admin() takes a parameter autoCreate. If you specify autoCreate=1 all the steps performed so far with the exception of committing the database will be performed automatically and you will have the user john already set up ready to test the system.

admin = web.auth.admin(driver='database', cursor=cursor, autoCreate=1)
connection.commit()