librelist archives

« back to archive

Advantages of Flask

Advantages of Flask

From:
Jonathan Chen
Date:
2010-11-12 @ 16:52
Hello everybody,

I'm just starting to get into Flask and I like it so far because of the
simplicity.

But my question and it might be too premature to ask is what are the
advantages of Flask over other frameworks (RoR, Django, Java stuff, etc.)
For instance, Django always mentions their admin-interface, quick
development, etc. What is Flasks technology advantages over others?

I think it would be good so that we can push marketing for Flask and get
more people taking a look and trying it out.

~Jonathan C.

Re: [flask] Advantages of Flask

From:
DasIch
Date:
2010-11-13 @ 12:42
The main advantage is definitely flexibility, you can easily adapt to
changing needs or new technologies without a huge drawback which would
occur in full stack frameworks. You can use Django without it's ORM or
template engine but if you do that you can't use admin anymore, you
can't use auth anymore and anything that depends on that or the ORM.

Another point would be the documentation and the possibility to easily
contribute to Flask or the other Pocoo projects as they now all use
github or bitbucket.

Re: [flask] Advantages of Flask

From:
danjac354@gmail.com
Date:
2010-11-13 @ 15:55
I remember years ago using CherryPy - after Zope it was a revelation
to see a complete web application in Python in just a few lines of
code.

The problem with CherryPy (and other "micro" frameworks such as
Bottle, web.py etc.) was "scaling up" - you ended up with a lot of
boilerplate in order to do mundane tasks such as connecting to a
database or ORM, sending emails, etc. Larger frameworks such as Django
did this out of the box but at a cost of flexibility and learning
curve.

Where Flask wins - other than the quality of its code and
documentation - is the use of extensions. You have the simple "one
line web app" simplicity of CherryPy, but instead of it ending there
you have a clear path for scaling up through extensions. However
unlike larger frameworks, these extensions do not form part of the
core Flask install and you are free to pick and choose or indeed
ignore them completely.

Generally speaking there are two kinds of web app projects these days
- those where you wire together large building blocks with some custom
glue and design work, and those where you are doing something
completely different. I see something like Django - with its
authentication, admin and tons of other ready-made apps - as ideal for
the former case, and Flask ideal for the latter - the next Foursquare
or Twitter, for example, or perhaps something just very specific to a
company's particular needs.

As for disadvantages:

1. The "micro-framework" label. Flask is labelled a micro-framework,
rightly or wrongly, and therefore unsuitable for large applications
(and all projects, if they live long enough, will grow over time).
This unfortunately is supported in the documentation, again rightly or
wrongly, whereas for example Pylons/Pyramid - which has a similar
scope - is not.

2. Thread-locals. Personally, I like them, but many (with some reason,
based perhaps on bad experiences with other frameworks) do not.
Certainly they require some discipline to use responsibly.

3. Lack of real-world examples. Not really fault of the framework
itself but just the fact that it hasn't been around long enough.
Django and Rails were "harvested" frameworks from real-world projects,
but new frameworks benefit from high-profile sites - for example,
Foursquare and Lift, Pylons and Reddit, etc. Hopefully this is
something that will change soon.



On 13 November 2010 12:42, DasIch <dasdasich@googlemail.com> wrote:
> The main advantage is definitely flexibility, you can easily adapt to
> changing needs or new technologies without a huge drawback which would
> occur in full stack frameworks. You can use Django without it's ORM or
> template engine but if you do that you can't use admin anymore, you
> can't use auth anymore and anything that depends on that or the ORM.
>
> Another point would be the documentation and the possibility to easily
> contribute to Flask or the other Pocoo projects as they now all use
> github or bitbucket.
>

Re: [flask] Advantages of Flask

From:
Zahari Petkov
Date:
2010-11-17 @ 16:00
I definitely agree with Dan's point of view and I would add a couple
of thoughts here.

On Sat, Nov 13, 2010 at 5:55 PM, danjac354@gmail.com
<danjac354@gmail.com> wrote:
> Where Flask wins - other than the quality of its code and
> documentation - is the use of extensions. You have the simple "one
> line web app" simplicity of CherryPy, but instead of it ending there
> you have a clear path for scaling up through extensions. However
> unlike larger frameworks, these extensions do not form part of the
> core Flask install and you are free to pick and choose or indeed
> ignore them completely.

Though the extensions are not part of Flask core, there are existing
guidelines for creating new extensions and also an extension approval
process exists, which guarantee to a certain level their quality.
Additionally extension authors are provided with a Sphinx
documentation template and a simple auto-generation script to help
them getting started quickly -- great time-savers that provide some
consistency between extensions.

> 1. The "micro-framework" label. Flask is labelled a micro-framework,
> rightly or wrongly, and therefore unsuitable for large applications
> (and all projects, if they live long enough, will grow over time).
> This unfortunately is supported in the documentation, again rightly or
> wrongly, whereas for example Pylons/Pyramid - which has a similar
> scope - is not.

I would call it rather a "core-framework" instead of "micro", since it
provides you with the complete set of tools to start web development
in the direction and approach you need and want -- nothing more and
nothing less. Also being a "core-framework" patches that conform to
the framework point of view can be accepted quickly, which is a huge
problem with the frameworks taken the mega-stack approach.

Re: [flask] Advantages of Flask

From:
Tim Golden
Date:
2010-11-13 @ 10:06
On 12/11/2010 4:52 PM, Jonathan Chen wrote:
> Hello everybody,
>
> I'm just starting to get into Flask and I like it so far because of the
> simplicity.
>
> But my question and it might be too premature to ask is what are the
> advantages of Flask over other frameworks (RoR, Django, Java stuff, etc.)
> For instance, Django always mentions their admin-interface, quick
> development, etc. What is Flasks technology advantages over others?

Ultimately (and I say this without any intention of being demeaning):
not a lot. Flask offers an approach to putting a website together
which is similar to other frameworks but with certain choices of
its own. Thus is the Python web framework world.

What Flask, I believe, brings is threefold:

* Simplicity -- it's quite straightforward to bring up a site of at least 
medium complexity

* Solid foundations in Jinja2 & Werkzeug -- Flask gets you going but you can drop
    straight down to Jinja2 & Werkzeug if you need more power. Flask has 
made a few
    choices for you to get things started, but you can use the other 
packages directly
    if needs be.

* Most importantly: great documentation -- all three packages: Flask, 
Jinja2 & Werkzeug
    have well-structured and very readable docs. I'm genuinely astonished 
at the quality
    (and the quantity!) of the text, and from someone whose first language
is presumably
    not English.

The reason that I say the docs are the most important is that it gives 
would-be and
existing users a real sense of security, that there's some hard work and coherent
thought behind the packages, and that even if Armin decided he'd had 
enough and moved
on, Flask would still be a viable and usable framework.

TJG

Re: [flask] Advantages of Flask

From:
alice ni
Date:
2010-11-13 @ 10:23
Advantages:-

1.Teaches you web development
2. Makes you learn a lot
3. Throws problems at you , and challenges you to solve it.
4.Helps you to build a application as customized as you want.
5. And yeah it teaches you a lot of python too

By the end of it,you are in love with it.I dont know about other
frameworks , as this is the only web framework I have ever used.

(and yes one suggestion-If you have decided to go ahead with flask,
first go through the docs thoroughly, then head straight to github,
and check out all those repos which end up when you search for flask
there, go through all their codes. I learnt a lot looking at all of
those codes)



On Sat, Nov 13, 2010 at 3:36 PM, Tim Golden <mail@timgolden.me.uk> wrote:
> On 12/11/2010 4:52 PM, Jonathan Chen wrote:
>> Hello everybody,
>>
>> I'm just starting to get into Flask and I like it so far because of the
>> simplicity.
>>
>> But my question and it might be too premature to ask is what are the
>> advantages of Flask over other frameworks (RoR, Django, Java stuff, etc.)
>> For instance, Django always mentions their admin-interface, quick
>> development, etc. What is Flasks technology advantages over others?
>
> Ultimately (and I say this without any intention of being demeaning):
> not a lot. Flask offers an approach to putting a website together
> which is similar to other frameworks but with certain choices of
> its own. Thus is the Python web framework world.
>
> What Flask, I believe, brings is threefold:
>
> * Simplicity -- it's quite straightforward to bring up a site of at 
least medium complexity
>
> * Solid foundations in Jinja2 & Werkzeug -- Flask gets you going but you
can drop
>    straight down to Jinja2 & Werkzeug if you need more power. Flask has 
made a few
>    choices for you to get things started, but you can use the other 
packages directly
>    if needs be.
>
> * Most importantly: great documentation -- all three packages: Flask, 
Jinja2 & Werkzeug
>    have well-structured and very readable docs. I'm genuinely astonished
at the quality
>    (and the quantity!) of the text, and from someone whose first 
language is presumably
>    not English.
>
> The reason that I say the docs are the most important is that it gives 
would-be and
> existing users a real sense of security, that there's some hard work and
coherent
> thought behind the packages, and that even if Armin decided he'd had 
enough and moved
> on, Flask would still be a viable and usable framework.
>
> TJG
>