I started both projects so I have an opinion on this topic. :-)
Use py4web.
web2py started in 2007 and it is now 14 years old. We learned a lot from it and py4web was thought of a successor.
py4web and web2py share:
- the same DAL
- the same validators
- the same template language (but a faster implementation)
- the same default multi-threaded web server (rocket3) but both work with any.
- almost equivalent helpers DIV, SPAN, etc (but simpler, faster, less gotcha, must be imported)
- similar web based IDE
- similar internationalization system (T) but better pluralization capabilities
- similar SQLFORM/Grid API called Form/Grid but more customizable and faster.
- both can run multiple apps behind one framework instance.
py4web is better than web2py because:
- it is at least 10x faster
- it is designed for Python 3
- you can "pip install py4web" and that is all you need to do
- no gotchas when using third party libraries
- it does not eval code at every request but uses normal python modules (every app is a module)
- it uses a routing syntax similar to bottle/flask
- it has an extensible Auth mechanism.
- it has better documentation (uses read-the-docs/sphinx)
- it has a much smaller code base and it is more modular
py4web lacks (when comparing to web2py):
- @auth.requires_login() decorators because we use a different mechanism @action.uses(auth.user)
- auth groups and permission because we handle groups and permissions with DAL Tags on users.
- CAS (because we have not finished implementing it) but we have better Oauth2 support, including Google, Facebook, and Ockta.
Gotchas:
- there is not request.args and request is the bottlepy/ombott Request object.
- auth.user is now called auth.current_user (auth.user is a Fixture) and this confuses people a bit.
- the web IDE and appadmin equivalent logic is more spartan and we are still improving it.
web2py is very stable has has not been touched in months.
py4web is still evolving we make commits almost every day.
I have ported my old apps to py4web without too much trouble.
Massimo
Example of py4web app:
from py4web import DAL, Field, action
from py4web.utils.form import Form
db = DAL("sqlite::storage.db")
db.define_table("thing", Field("name"))
@action("thing", method=["GET", "POST"]) # create form with postbacks
@action("thing/<id:int>", method["GET", "POST"]) # edit form with postbacks
@action.uses(db, "index_template.html") # specify the template file
def thing(id=None):
form = Form(db.thing, id) # same as SQLFORM(db.thing, request.args(0)).process()
return dict(form=form)