a few months ago I was looking for a web development framework that is less painful and fun. Earlier I’ve been using web2py and I was partially satisfied of what it can do in a very short period of time. However, after I started to use web2py in production I was hit by the following facts that made me completely unhappy
Disadvantages of web2py
- web2py doesn’t support unit testing, it supports doctests which is far from being optimal for a testing freak like me and is too limited in terms for the scope, you cannot really do the same level of tests you used to do in normal server side or desktop programs.
- web2py does use Python which is my favorite scripting language so far and the one that I have been using for the last couple of years continuously. While Python is a great language it was used in a twisted way to design the framework, Python magic was all over the place, variables defined globally are allover, you cannot see real OO in the design, plus the code follows PEP-8 which I hate its do_blah_function style (lots of underscores).
- Very bad error reporting, although this is quite debatable but I’ve been quite dissatisfied with that and let me tell you my reasons:
- Web2py does not differentiate between development mode and production mode, if an exception is thrown a ticket is generated all the times and you will gave to navigate to the ticket to see the error. In production that would be useful (although I would have loved to see more control on how/where the ticket is stored/generated. In development mode this is a headache, I really need to see the error instantly and not to see a ticket number!
- The error message for a syntax error or coding errors in web2py is ambiguous (try doing a mistake in the model) that’s because web2py takes your code and merges it into larger file to run, thus, it cannot determine the line number of the error or the source of the error correctly.
- web2py also doesn’t have a decent ORM, it has a nice database abstraction layer (DAL) that abstracts many types of database engines in a nice way, but remains the way you define the tables and fields a completely functional (not OO). When you get to have a relatively large model you will get your code scattered by all nested definitions and attributes that will make things harder to maintain.
- web2py has really poor IDE support and you cannot use standard python development tools without modifications — for me this is a serious issue.
- Using the python CPython interpreter limits the whole application to run only on a single core because of the GIL, however, this is not web2py limitation, this is a limitation defined by the implementation of the python interpreter and can be eliminated if you changed the interpreter to Jython or moved away from asynchronous non-blocking socket web server that uses multiple threads, and started using multi-process webserver so that you get multiple python interpreters running. I’m not really sure if web2py has done anything to ensure better concurrency or not.
Advantages of Web2py
Web2py remains to be the best Python web development framework I’ve ever seen, easily beats django and turbogears in terms of the speed and simplicity of the development.
- Web2py uses python-based template language which is one of the coolest things I’ve seen in this framework and this will kick start python developers to start writing code immediately after understanding the basics of writing templates as views.
- Web2py can run python compiled code as an optimization to lower the running time and to allow you to distribute your code in a compiled fashion.
- Web2py has a capable DAL that will let you forget “partially” that you need an ORM and it’ll make things easier for those who don’t want the full-fledged ORM in their software.
- The framework in production is really fast and with some optimizations and tuning you can minimize the memory footprint so you can run on a really small VPS or slice
- Provides a comprehensive administration web interface that has integrated editor and source control (scm support is far from being really usable)
- web2py makes is super easy to write web services, xml-rpc or JSON
- Good support of different caching techniques/technologies, like memcache, disk cache, ram cache.
Summary
Web2py is a free, fast, secure web development framework that’s entirely written in python and encourages using python in every aspect (model, view, controller). A very good framework for small web applications or prototypes but fails to fulfill the enterprise class quality requirements because the complexity of solving bugs will increase exponentially because of the lack of unit tests, good and accurate error reporting, and scattered model.










by gamal
01 Aug 2010 at 17:30
GREAT REVIEW !
ماشاء الله ..
Pingback
by Tweets that mention The good and bad about web2py | That's me - LiNuXaWy -- Topsy.com
01 Aug 2010 at 17:30
[...] This post was mentioned on Twitter by AlSayed Gamal and Reem Al Ashry, AhmedSoliman. AhmedSoliman said: The good and bad about web2py http://bit.ly/c1FlCK [...]
by Amal Elshihaby
01 Aug 2010 at 22:59
You are right
Despite of all of these disadvantages , web2py is really a great framework and has a lot of advantages and i have enjoyed using it.
But there is another thing i didn’t like is that i can’t use SQLFORM, CRUD and Validators in Ajax application
by Scott
01 Aug 2010 at 23:44
Discussion thread: http://groups.google.com/group/web2py/browse_thread/thread/1142aa8ab1de80cb
I cover several of these points there and invite your feedback along with the rest of the web2py community. Thank you.
by Massimo
02 Aug 2010 at 01:09
Hello Ahmed. Nice article.
A few comments:
web2py runs with Jython. We just consider CPython the reference platform. There is a known bug in the Java regex library that sun marked as wontfix that can cause occasional runaway problems with parsing templates in Jython. It is not a web2py specific issue but I thought I’d mention it.
You can use unit tests with web2py. web2py it self has unit tests in the gluon/tests folder. You can run unit tests for your apps from the shell (as you would do in other Python frameworks) although you cannot run them through the web IDE. The web IDE only supports doctests and you are correct about that.
Web2py is known to work with WingIDE, Eclipse and IntelliJ.
It is true that web2py does not distinguishes production from debugging mode but to clarify: this is because webp2y always in production mode yet it always logs all the errors. If the current user is logged in as administator he/she has access to the error tickets and error tracebacks.
Web2py follows PEP8 internally but it does not import application code, executes it. In this environment it exposes some symbols. Some symbols are per-http-request. Some symbols are system wide. The latter are all caps because should be treated as constants and not modified. I feel this is consistent with PEP8. The naming scheme is explained in the first chapter of the manual.
You are also right that web2py has a DAL, not an ORM. The main difference is that in a ORM a table is a class and a record is an instance of that class. In the web2py DAL the table concept is a class but each table is an instance and each record is a dictionary. In my view both approaches are object oriented. For example this is a query with the web2py DAL:
for row in db(db.mytable.myfield>0).select(): print row.myfield
and this the same query with the Django ORM:
for row in Mytable.objects.filter(myfield__lt=0): print row.myfield
In my opinion the former looks more OO than the latter.
by Massimo
02 Aug 2010 at 03:33
I was just pointed to this:
http://packages.python.org/web2py_utils/test_runner.html
(unitests howto for web2py)
by Ahmed S. Farghal
02 Aug 2010 at 13:53
my reply in http://groups.google.com/group/web2py/browse_thread/thread/1142aa8ab1de80cb
by Ahmed S. Farghal
02 Aug 2010 at 13:56
Ok, I decided to reply here too to make things clear for everybody
Ok, I would like to elaborate more on the points I’ve mentioned.
1- Web2py does not support unit testing out of the box and if you want
to hack everything to get unit testing well integrated you can but
this still doesn’t mean the framework support unit testing, and by
that I mean the ability to test complete scenarios, have you tried to
write a unit test for controller that has SQLFORM in it? the double-
submission check will make your life miserable if you tried to do unit
tests that simulates form submissions. Also you will need to do a lot
to create correct fixtures that would bring the web2py environment up
and down before and after every test. Plus, there is no selenium
testing integration like how other frameworks do.
2- By saying “twisted” means that you have things that are
automagically imported for you and many things are imported by default
according to import_all, also you have a lot of variables like
“response, request, session, etc.” that are magically inserted into
the execution environment, such design is OK but not Good, as I can’t
see the context and there is a little of referential transparency in
there. You can’t see what’s being passed or imported, neither the IDE.
3- In error reporting, If you tried to write a mistake in the
template, the question is, does it show you the error “correctly”?
does it show you the right line number as in your source file?
4- About the DAL and not ORM, that’s OK and I understand that you
chosen the DAL choice based on your experience with ORMs but from my
personal point of view that your implementation of DAL is too close
from being an ORM but without a decent way of defining the entities,
you simply nest everything into a possibly one or more calls to create
tables with validators in a pure functional way. My problem with that
is that “flat is better than nested” and the code becomes scattered
especially in the model
4- Yes, I already explained that CPython implementation is the real
limitation and not web2py, this is a python-related issue and not
web2py but still web2py is affected.
5- Yes, Python does work on Eclipse, IntelliJ, etc. but does web2py
work smoothly and easily? for instance, to get web2py working
correctly on eclipse (PyDev) you will need to put stupid nonsense
imports ( if 0: import ) on the top of every file because of the
“magic” I mentioned before., you will need to manually redefine
request, response, session, etc. variables in that dummy if condition.
You don’t get proper auto completion because almost everything happen
in the runtime (like dicts masked as attributed objects). So, simply,
By design no IDE can help you much unless we hardcoded much of that
stuff into the IDE itself.
6- I also would like to add that the current design on the plugin
system, looks more like a hack rather than a modular, conflict-safe
scalable system.
Btw, I still like web2py very much and I would like to contribute when
possible on making things better but that might include general
philosophy changes.1
Thanks for the great community.
by Richard
02 Aug 2010 at 19:16
Good review.
For managing large models I typically create a wrapper class that implements all the DAL interactions I need.
by Julio Schwarzbeck
02 Aug 2010 at 19:35
Nice article Ahmed, Posts like this just show that the framework is gaining momentum- a quick view on your issue #5 above: I am using Wing IDE for instance and its integration is flawless, you get all the “goodies” and perks any dev expects from a developing platform, I will soon post in my website a set of screenshots to show this.
While I agree that overall web2py has its issues (I agree with you about unittesting), it’s been the most impressiveweb app framework I’ve used in years (python-based), and I go back to the Zope 1.x days!
Cheers ank keep up your good work,
Julio
by Narendran G
17 Sep 2010 at 19:43
Great review Ahmed. I like the framework a lot. Lack of good IDE support is my biggest paint-point.
I use Eclipse to develop web2py apps, following all the guidelines, but the ease-of-use is still not up there (I really miss auto-completion of DAL classes.) A full-fledged web2py plugin for Eclipse (just like the way we have for Django), will definitely help.
by Ahmed S. Farghal
20 Sep 2010 at 20:13
definitely agree with you.
by mcwong
14 Feb 2011 at 09:00
Yes, very short learning curve and aids in learning python as well.I went through the entire Django tutorial but didn’t have sufficient know how to apply it. Read the overview chapter of the Web2py book and I can create and deploy to Google apps in 2 days.