Web2py or py4web for a brand new project

1,002 views
Skip to first unread message

icodk

unread,
Dec 12, 2019, 9:17:05 AM12/12/19
to web2py-users
Should I use Web2py or py4web for a brand new project ?
What is still missing from py4web  ?
Can I debug with pycharm ?
I need all the great authentication I got with web2py : Registration,pass change, groups mail, etc.
smartgreed will be very nice to have or similar.
Stability ?
Can it be deployed with nginx  and pg ?
Thanks

Massimo Di Pierro

unread,
Dec 15, 2019, 4:09:14 PM12/15/19
to web2py-users
Good question.

web2py and py4web share a lot of libraries and their syntax is very similar. Both will be maintained.
web2py was born in 2007 and it is mostly for Python 2 although it now works well with python 3.

As a rule of thumb, if you are porting a Python 2 project to Python 3, use web2py.
If you are starting from scratch, use py4web.

py4web is ~20x faster. Code is much easier to read.
They are both solid for production (except none works with py3.8 but we are fixing that)
They share pydal, templates, multi-app structure, ticket system.
The request object and routing mechanism is different and py4web uses the bottlepy ones.
They both have an internationalization/pluralization system and the py4web one is better but it lacks a UI (building one would be a good 1 day project).
They both have Auth but they are incompatible. The py4web is more modular but less tested. (fixing those bugs is a priority, but need testers)
web2py has SQLFORM, py4web has py4web.utils.form.Form. They are pretty much equivalent but the latter does not support fields of type list:* (+)
web2py has SQLFORM.grid and SQLFORM.smartgrid, py4web has Vue component <mtable> They are pretty much equivalent but the latter does not support fields of type list:* (+)

(+) indicates things that are missing but we have no plan to add them. Th world is moving to single page apps (vue, angular, react, etc.) and with py4web we wanted to move away from generating complex HTML serverside because it does not scale to complex projects. If you need tables and complex interfaces, you should implement them in vue/angular/react/etc. So we have no plans to add that functionality. What is considered good practice has changed.

Massimo

Andrew Rogers

unread,
Jan 15, 2020, 1:03:58 AM1/15/20
to web2py-users
Thanks for that info. I am about to start a new project which is also my first. So i would like to go with py4web. But i am nervous about not having good documentation for py4web.

Is the old documentation and videos etc that you have made (which are great - thanks) still mostly relevant?

Andrew Rogers

unread,
Jan 15, 2020, 1:03:59 AM1/15/20
to web2py-users
Hi

Is  the documentation for web2py still mostly relevant for py4web?

Thanks
Andrew

Massimo Di Pierro

unread,
Jan 21, 2020, 1:56:18 AM1/21/20
to web2py-users
You should use the py4web documentation. Also please report any error you find.

AGRogers

unread,
Jan 22, 2020, 6:21:05 AM1/22/20
to web...@googlegroups.com
OK, thanks. Re reporting errors, I suspect most errors will be due to my ignorance. But thanks for the encouragement. 

--
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 web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/d6c0a99a-42c9-4b04-91ab-56c8ac72b8c4%40googlegroups.com.

Carlos Costa

unread,
Jan 22, 2020, 1:33:10 PM1/22/20
to web...@googlegroups.com
Hey Massimo, thanks for the great info.

How about porting apps from web2py to py4web?

What steps would you recommend?



--
At.

Carlos J. Costa
--------------------------------------------------------------
Cientista da Computação - Esp. Gestão em Telecom

Jim S

unread,
Jan 22, 2020, 3:47:26 PM1/22/20
to web2py-users
For me, there is no porting, it is re-writing.  While a lot of the capabilities are there in py4web not all are part of py4web.  Due to the nature of how things work, a lot of the 'global' structures in web2py have to be handled differently in py4web.

SQLFORM.grid is gone.  FORM replaces SQLFORM but doesn't have all the features - https://py4web.com/_documentation/static/index.html#chapter-10
auth_group and auth_membership and auth_permission are gone - authentication/authorization have changed - https://py4web.com/_documentation/static/index.html#chapter-11

With those things being what they are, I've been playing with py4web for a few days now and really am liking it.  It is crazy fast.  You may have to write some more helpers to do some things that web2py did for you, but that's half the fun, isn't it?  For instance, I used the grid that web2py's SQLFORM.grid provides for lots of listing pages.  py4web doesn't have one so I've written a helper that displays  pages the way my app wants to see them.

I believe py4web is going to make it easier to use Vue.js in your pages, but I haven't made the just to using Vue yet so I can't really comment on that part.

-Jim


On Wednesday, January 22, 2020 at 12:33:10 PM UTC-6, Carlos Costa wrote:
Hey Massimo, thanks for the great info.

How about porting apps from web2py to py4web?

What steps would you recommend?

Em qua., 22 de jan. de 2020 às 08:21, AGRogers <roge...@gmail.com> escreveu:
OK, thanks. Re reporting errors, I suspect most errors will be due to my ignorance. But thanks for the encouragement. 

On Tue, Jan 21, 2020, 1:26 PM Massimo Di Pierro <massimo...@gmail.com> wrote:
You should use the py4web documentation. Also please report any error you find.


On Tuesday, 14 January 2020 22:03:59 UTC-8, Andrew Rogers wrote:
Hi

Is  the documentation for web2py still mostly relevant for py4web?

Thanks
Andrew

On Thursday, 12 December 2019 20:47:05 UTC+6:30, icodk wrote:
Should I use Web2py or py4web for a brand new project ?
What is still missing from py4web  ?
Can I debug with pycharm ?
I need all the great authentication I got with web2py : Registration,pass change, groups mail, etc.
smartgreed will be very nice to have or similar.
Stability ?
Can it be deployed with nginx  and pg ?
Thanks

--
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 web...@googlegroups.com.

--
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 web...@googlegroups.com.

Kevin Keller

unread,
Jan 22, 2020, 5:31:11 PM1/22/20
to web2py-users
Jim,

Could your helpers be considered to be added to thr py4web code base? 

If you say you have a sqlform.grid equivalent or something in that direction? 

I think there was mtable that should take the spot, but haven't seen any examples yet or at least none thst would replace a sqlform or smartgrid. 

If it is not coming I would probaly consider using datatables js in the future. 




To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/dbd62f85-d7bc-40a2-a8f5-1b5651525020%40googlegroups.com.

Jim S

unread,
Jan 22, 2020, 5:50:11 PM1/22/20
to web2py-users
Yes, I will post my main utils.py when I have it working better.  I still have to clean up a couple pieces.  It would be up to Massimo if he wanted to add it.  But in response to one of my earlier questions I was told Massimo kept a utility like this out of py4web so people might use better tools like datatables.  And, I doubt my code is 'framework-ready'.  But it could give others insight into how you can work with py4web.

Speaking of datatables, I wrote a datatables integration for web2py last summer.  I think I could also add that to my utils.py pretty easily.  Actually, the datatables piece would be easier that what I've done writing my own.  Would you use datatables for complete CRUD, or just to list your table for record selection, etc.?

Now that you mentioned mtable, I too recall hearing that before, but haven't gotten in to it at all.  Like I said, I haven't jumped in to the client-side javascript much yet, other than jquery.

-Jim

Kevin Keller

unread,
Jan 22, 2020, 6:04:07 PM1/22/20
to web2py-users
The datatables integration for web2py would be super useful. I'm sure we could port it over to py4web easily.

I just feel like with all the stuff web2py gave us to get something quickly going missing, it'd just another api framework and there are fastapi and apistar as well falcon out..

I think having these ease of use stuff back would really hit home and would also make it easier to port from web2py.

And we would be pretty much the Jhipster  of the python world no?



To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/fa9b9628-dfe8-4ef2-8f95-790d47491456%40googlegroups.com.

Carlos Costa

unread,
Jan 22, 2020, 6:29:19 PM1/22/20
to web...@googlegroups.com
Thanks for sharing you experience with py4web, Jim.


Christian Varas

unread,
Jan 23, 2020, 7:44:19 AM1/23/20
to web...@googlegroups.com
Thanks for all that you share guys.

I would like to ask for a recommendation.

I have a web interface made with web2py, this interface manage a web application firewall (nginx and modsecurity). It does commands and file modifications in the system to manage properly the WAF, the database is SQLite.
I don't use sqlform.grid, most of the things in the view are made with pure JavaScript and Html, and all the commands to the system are with subprocess.
Works pretty fast and without any issue.

My question is if py4web is ok to do this tasks too, like editing files in system, executing commands and task more oriented to the system and not to a db.


Now I have to a small adpatation to my app because modsecurity has a new version and they changed some things, and I was thinking that maybe I can port all to py4web and have a fresh new start, but I'm not sure..., I love web2py and now is easy to me to do things with him.

Should I stay in web2py? 
Or I should start using py4web for this kind of project?

Cheers!
Chris.


Jim Steil

unread,
Jan 23, 2020, 9:27:08 AM1/23/20
to web...@googlegroups.com
Sounds like a great app to do in py4web.  
  1. You are already comfortable with javascript.  
  2. You're not using grid/smartgrid.  
  3. Are you using the web2py auth system with permissions?  If only using groups (roles) then this would be great to do with py4web.  
  4. Much faster and you get to use Python3.
-Jim


You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/SWGmaw31KJE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/CA%2Bs%2BuJs_GQgVhrTLHtc%2BsNZvZuCx%3DzbeY%3D0kcRd-z5%3DKsNFTYw%40mail.gmail.com.

Christian Varas

unread,
Jan 23, 2020, 10:47:43 AM1/23/20
to web...@googlegroups.com
Hi Jim.

Yes I'm using the auth system permission.
I'm using 2 decorators in fact
@auth.requires_membership() and @auth.requires_login()

I'm gonna port my app to py4web then :) 

Thanks

Cheers.
Chris 

Jim S

unread,
Jan 23, 2020, 10:57:12 AM1/23/20
to web2py-users
You'll be fine with the new system I believe as long as you're not currently using @auth.has_permission.  While you can do it with py4web it is more challenging than in web2py.

-Jim

--
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 web...@googlegroups.com.


--
At.

Carlos J. Costa
--------------------------------------------------------------
Cientista da Computação - Esp. Gestão em Telecom

--
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 web...@googlegroups.com.

--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/SWGmaw31KJE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web...@googlegroups.com.

--
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 web...@googlegroups.com.

Lovedie JC

unread,
Jan 23, 2020, 11:02:00 AM1/23/20
to web...@googlegroups.com
Is there a problem with @auth_has _permission?
I intend to use it. 
Regards 

To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/c5e972b9-32c1-4baf-a10a-6c39910c8b68%40googlegroups.com.

Kevin Keller

unread,
Jan 23, 2020, 11:09:26 AM1/23/20
to web2py-users
I havent looked at py4web so far, because I dont get how it does permission in general. 

Is there an easy way to use JWT tokens and OIDC/OAUTH2 with Vue.js easily?

I think its quite a pain to go through this in general. 
This is why I really liked about rendered HTML page apps. 

If its not a complex app for a long term project I lied the OOTB auth and crud mechanism. 

Making every app a SPA app now I have to deal with REST payloads, seriazlzing, de-serializing, JWT tokens, OAUTH/OIDC etc. 
And for my apps I dont need the increase in loading times or less calls to the back end so much. 

But maybe there are ways to make this simple as well with py4web and vue.js. 





Jim S

unread,
Jan 23, 2020, 11:55:05 AM1/23/20
to web2py-users
No problem with auth.has_permission web2py.  But I don't think it exists in py4web.  Someone please correct me if I'm spreading misinformation.  You can write it yourself, but I don't think it's included in py4web.

-Jim
Reply all
Reply to author
Forward
0 new messages