Hacker News new | ask | show | jobs
by irahul 5203 days ago
I am missing the purpose of this library. When I use Flask, I use Flask-SQLAlchemy for Data Access and ORM, Flask-WTForm for forms and Jinja2 for templates. I don't see what I gain by using the web2py components in Flask.
2 comments

I actually moved from web2py to Flask and Flask-SQLAlchemy as my framework of choice because of the limitations imposed by the web2py DAL (try modeling a school, for example, with the relationships between teachers, students, parents, and classes. It's very difficult in practice on the DAL).

The rest of the web2py framework is excellent, and support is very good. I wish Massimo had spent some of the time he spent adapting web2py to other frameworks on adapting web2py to SQLAlchemy instead. I'd be back in a second.

> The rest of the web2py framework is excellent, and support is very good.

Which parts? IMO, the web2py framework is not excellent.

It sounds like you hit some limitations with the DAL and switched away, but those type of limitations are peppered throughout the framework.

Web2py is not well designed, not standard python (look at the source), and it tricks newbies into bad practices.

Sounds like FUD. Care to share some examples? Note, in most cases, the DAL has fewer, not more limitations than a typical ORM. web2py does use standard Python. What bad practices? Have you seen this: http://www.infoworld.com/slideshow/24605/infoworlds-2012-tec...?
> try modeling a school, for example, with the relationships between teachers, students, parents, and classes.

The DAL can be used to model any set of tables and relationships that can be created in an RDBMS, so it's not clear what the problem would be modeling the relationships among these entities. Should be fairly straightforward.

It would be interesting to see how you tried it in the DAL and the alternative that you found easier in SQLAlchemy. Can you show an example?
Thanks for asking politely (I mean that truly). I'm on deadline now but I'll post back here in a day or two with the problems I ran into.
Great. Thanks.
Point me to one SQLAlchemy example that you think has no web2py DAL equivalent and I will try show you otherwise.
From my prospective if one likes the web2py libraries, one should use just web2py and not other frameworks. Some web2py users have also complained: what's the point? I think the point is that everybody could learn something from trying to use different tools. I have learned a lot about the other frameworks just trying to implement this. I think others could learn something too from just reading the example code.
> I think the point is that everybody could learn something from trying to use different tools.

Sure. I have used web2py for small projects, and have used Flask and Django heavily. I like Flask because it doesn't try to be everything and allows you to build your application by assembling a set of components. Well, all applications are built that way, but my point is Flask doesn't even try to provide the ORM or templating engine.

What it does is let you to choose your components, and build over the base framework. Also, it comes with a set of recommended components which are wrapped for making it natural for use in Flask.

I have tried almost all python frameworks in some capacity, and Jinja2 is a clear winner for me among all the templating options. It's fast, concise, and doesn't tell me I am an idiot and therefore I am not allowed to have code in my template - it advises against it, yes, but doesn't go out of its way to prevent me from doing it.

Raw sqlalchemy is verbose, but declarative extension solves that issue, and you can always wrap it to make it more natural. Flask-SQLAlchemy integrates nicely with Flask, and you have an option to access sqlalchemy session directly.

Learning something from different tools is good, but ultimately we need to decide upon a set of tools for a given problem.