Giving a talk promoting web2py over Django

459 views
Skip to first unread message

Alec Taylor

unread,
Aug 1, 2012, 11:46:48 AM8/1/12
to web...@googlegroups.com
Tonight I'm going to present my little social-network to a user-group.

I'm going to show them my code, some slides, the website, the mobile apps and tell them when Django isn't as good as web2py.

Are there any particular features of web2py you would recommend I highlight? - Also, are there any major drawbacks in Django that web2py has that is easily advertisable?

(I have a slide or two on this, but I'm sure as longtime users/developers of web2py you'd have more to pitch-in)

Thanks for all information,

Alec Taylor

vinic...@gmail.com

unread,
Aug 1, 2012, 11:57:57 AM8/1/12
to web...@googlegroups.com
We2bpy strengths over Django:

1) Automatic migrations. It enforces baby steps design just
out-of-the-box. South migrations is a powerful tool, but Django doesn't
have it natively yet.
2) Web2py shows a generic template when you don't have one created. Yet,
baby steps guaranteed.

I see these 2 as good features to Web2py newbies.


--
Vinicius Assef
> --
>
>
>

Michele Comitini

unread,
Aug 1, 2012, 12:16:48 PM8/1/12
to web...@googlegroups.com
Less boilerplate code.
Sane defaults.

mic

--




Bruno Rocha

unread,
Aug 1, 2012, 12:17:29 PM8/1/12
to web...@googlegroups.com

web2py has a more flexible template engine, you can use Python there and does not need to create a tons of template filters to get simple things done. Also in Django the template language sucks a lot because of the limitations.

Let me give an example:

To build a map using google maps API you have to inform the lat/long, for some reason in my database the information was stored as "-23,4500" google maps does not accept it with the comma, so it is easy with Python and web2py.

<script>
map = new GMap({"lat": {{=myplace.lat.replace(",", ".")}}, .....)
</script>

As you can see web2py allowed me to use pure Python code for this.. lets try this in Django...

1. Put the template tags configuration in your settings.py
2. Create a directory called templatetags there
3. Create a module for your template tag
4. import, register, decorate and create your template tag

from django import template

register = template.Library()

@register.filter
def replace(value, args):
    value = str(value)
    args = str(args)
    try:
        search, replace = args.split("|")
    except Exception:
        return value
    else:
        return value.replace(search, replace)

Template tags/filters are limited functions which receives only one argument, so you have to receive this as string to be able to split them un multiple args.

5. Now in your template file you can use the simple "replace" feature in a weird way

<script>
map = new GMap({"lat": {{ myplace.lat | replace: ",|." }}, .....)
</script>

web2py templates are also very good for some other reasons:

- it allows to create HTML functions
- It has a nice block system
- It allows us to use PURE PYTHON to solve simple things!



--




Michele Comitini

unread,
Aug 1, 2012, 12:18:14 PM8/1/12
to web...@googlegroups.com

Anthony

unread,
Aug 1, 2012, 12:22:57 PM8/1/12
to web...@googlegroups.com

Luther Goh Lu Feng

unread,
Aug 1, 2012, 12:54:23 PM8/1/12
to web...@googlegroups.com
Backward compatibilty is a strong plus for me.... especially for very old sites that you leave idle for a long time and then want to upgrade to the latest web2py version

Anthony

unread,
Aug 1, 2012, 12:57:23 PM8/1/12
to
If it's a Django-friendly crowd, it might also be helpful to be prepared to handle the inevitable criticisms that will come. The big issues that tend to arise are (a) global objects/lack of imports/lack of explicitness/too much magic, (b) use of exec, and (c) pure Python in views. The links below address these and other criticisms.

Anthony

On Wednesday, August 1, 2012 11:46:48 AM UTC-4, Alec Taylor wrote:

Massimo Di Pierro

unread,
Aug 1, 2012, 1:23:09 PM8/1/12
to web...@googlegroups.com
I really have nothing to add but some history. 

I was a Django programmer (although never a Django contributor) and I have developed web sites for the United Nations in Django. I have taught Django here at DePaul University. I started web2py as a teaching because I found the learning curve with Django was too steep. Moreover when web2py was created Django was not the same as today. It did not have the template escaping on by default (web2py did), it had a bug in CSRF protection (web2py's one always worked), did not have migration (still does not but now there is third party solution), did not support multiple database connections (there was as Django fork but it took long time to be merged), did not support multiple projects (web2py always did), did not support left joins and aggregates (web2py always did). Django always supported less database engine than web2py (and some not very well, for example web2py generates better SQL code for pagination in Oracle). Django always had and still has a more polised and customizable admin (equivalent to web2py's appadmin) and a better interface for many-to-many relations.

They are philosophically differences:
Django preferes "explicit is better than implicit" so you have do define lots of boilerplate
web2py says "do not repeat yourself" so you have lots of default behavior (magic?) but documented and backward compatible.

Other communities have used various arguments to criticize some web2py's design decisions. All design decisions have pros and cons. Some of the criticism has legs and some has not. What is important is that those decisions were not motivated by ignorance but by carefully considering the alternatives. As a result of those design decision web2py is the only framework that allows hot install and uninstall of apps without restarting the web server (with any web server) and supports multiple projects under one web2py instance without library conflicts.

I also want to stress that our community is very friendly. We have always shown great respect for other people's work and we have tried to learn from them. We have taken ideas from Django, TG, Flask, etc and we proudly acknowledged it.

Massimo




On Wednesday, 1 August 2012 11:55:32 UTC-5, Anthony wrote:
If it's a Django-friendly crowd, it might also be helpful to be prepared to handle the inevitable criticisms that will come. The big issues that tend to arise are (a) global objects/lack of imports/lack of explicitness/too much magic, (b) use of exec, and (c) pure Python in views. The links below address these and other criticisms.

Anthony

On Wednesday, August 1, 2012 11:46:48 AM UTC-4, Alec Taylor wrote:

Cliff Kachinske

unread,
Aug 1, 2012, 5:21:51 PM8/1/12
to web...@googlegroups.com
I auditioned a lot of web frameworks in various languages.  Web2py was the only one that allowed me to be instantly productive when it came to porting my PHP apps.


On Wednesday, August 1, 2012 11:46:48 AM UTC-4, Alec Taylor wrote:

Alec Taylor

unread,
Aug 2, 2012, 9:47:14 AM8/2/12
to web...@googlegroups.com
Thanks for all the advice, I think the talk went quite well.

It seems that the hardcore Django people aren't going to be switching, the Flask people are considering and everyone else is saying how evil the views are 

On the bright side, it seems to be the framework everyone will now recommend for people new to Python.



Also, I got two job offers from it 
35D.gif
341.gif
33C.gif

Massimo Di Pierro

unread,
Aug 2, 2012, 11:02:26 AM8/2/12
to web...@googlegroups.com
well done.

:-)

vinic...@gmail.com

unread,
Aug 2, 2012, 11:50:35 AM8/2/12
to web...@googlegroups.com
Massimo, about hot install applications, it's true just if you use
default routes, right?

Or there's some way to do that using custom routes?

--
Vinicius Assef
> * http://www.quora.com/Is-web2py-a-good-Python-web-framework/answer/Anthony-Bastardi
> <http://www.quora.com/Is-web2py-a-good-Python-web-framework/answer/Anthony-Bastardi?__snids__=28309519#ans341179> (scroll
> a bit for response to criticism by Jacob Kaplan-Moss, creator of
> Django).
> * https://groups.google.com/forum/#!msg/web2py/uIYf-dTjd88/P8yxUQwTZk4J
> <https://groups.google.com/forum/#!msg/web2py/uIYf-dTjd88/P8yxUQwTZk4J>
> * http://news.ycombinator.com/item?id=3767009
> <http://news.ycombinator.com/item?id=3767009>
> * http://www.web2py.com/AlterEgo/default/show/271
> <http://www.web2py.com/AlterEgo/default/show/271>
> * http://greg.thehellings.com/2011/01/python-web2py-or-django/#comment-546
> <http://greg.thehellings.com/2011/01/python-web2py-or-django/#comment-546>
> * http://www.quora.com/What-are-the-advantages-of-web2py-over-Django/answer/Daniel-Greenfeld/comment/478595
> <http://www.quora.com/What-are-the-advantages-of-web2py-over-Django/answer/Daniel-Greenfeld/comment/478595> (addressing
> criticism of pure Python in views)
>
> And a little support from Zed Shaw regarding "magic":
> https://twitter.com/zedshaw/status/80415443558477825
> <https://twitter.com/zedshaw/status/80415443558477825>,
> https://twitter.com/zedshaw/status/80418794526351360
> <https://twitter.com/zedshaw/status/80418794526351360>
>
> Anthony
>
> On Wednesday, August 1, 2012 11:46:48 AM UTC-4, Alec Taylor wrote:
>
> Tonight I'm going to present my little social-network to a
> user-group.
>
> I'm going to show them my code, some slides, the website, the
> mobile apps and tell them when Django isn't as good as web2py.
>
> Are there any particular features of web2py you would recommend
> I highlight? - Also, are there any major drawbacks in Django
> that web2py has that is easily advertisable?
>
> (I have a slide or two on this, but I'm sure as longtime
> users/developers of web2py you'd have more to pitch-in)
>
> Thanks for all information,
>
> Alec Taylor
>
> --
>
>
>

Massimo Di Pierro

unread,
Aug 2, 2012, 2:19:31 PM8/2/12
to web...@googlegroups.com
hot install is always there and apps can come with their own app-level routes. The only issue is that a global route can mess up access to apps if not done properly.

Alec Taylor

unread,
Aug 12, 2012, 2:13:54 PM8/12/12
to web...@googlegroups.com
Hi gm, they're mostly just things promoting my project; but happy to share.

http://goo.gl/gnyWP

On Sat, Aug 11, 2012 at 1:27 AM, gm01 <ghc...@gmail.com> wrote:
> Love to see your slides you presented. Are they available somewhere on
> line?
> Thanks,
> gm
>
>
> On Wednesday, August 1, 2012 11:46:48 AM UTC-4, Alec Taylor wrote:
>>
> --
>
>
>
Reply all
Reply to author
Forward
0 new messages