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)



On Tuesday, 5 October 2021 at 11:50:19 UTC-7 Jim S wrote:

> I am biased, but do yourself a favor and write it with py4web.
>
> The execution isn't just a little bit faster, it is orders of magnitude 
> faster.
>
> Check out the SouthBreeze sample app I wrote using py4web, bulma and 
> htmx.  https://southbreeze.pythonbench.com
>
> Documentation for web2py is better, but a lot of it translates to py4web.
>
> Are you an experienced web2py developer?  If so, check out the py4web docs 
> on web2py and py4web differences -> 
> https://py4web.com/_documentation/static/en/chapter-15.html
>
> Major update to the py4web git repo yesterday that takes replaces Bottle 
> in py4web with ombott written by ValK.  
>
> Another recent change with significant performance improvement is the move 
> from yatl to renoir for template rendering. No syntax changes, just LOTS 
> faster.
>
> Using htmx for reactivity in the front end is significantly easier than 
> using JS libraries/frameworks for front-end development (again, my 
> opinion).  https://htmx.org
>
> Ok, I'll shut up now....
>
> We're here to help with py4web questions on the google group or the 
> discord channel https://discord.gg/xCzQ9KTk3W
>
> -Jim
>
> On Tuesday, October 5, 2021 at 8:50:49 AM UTC-5 [email protected] 
> wrote:
>
>> Today I've discovered that web2py has a child called py4web. Now I'm 
>> confused about when to choose any one of these.
>>
>> Documentation says py4web is faster than web2py, but it seemed to me 
>> py4web is also more difficult to work with (although I can see that's for a 
>> justifiable reason).
>>
>> So, does anyone has some guidelines for choosing between them?
>>
>> Note: I'm devising an ERP system using web2py (or maybe py4web now) for 
>> the backend, webix (pure JS library -- not framework -- for the frontend) 
>> and postgresql. I'm also thinking about using meta-modeling for this whole 
>> project.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/682e65d8-be81-4a72-a0ae-aa8b23b944f5n%40googlegroups.com.

Reply via email to