views:

143

answers:

2

Hi so as the title suggests, am just diving into web development. And if you might see my last post, it was about understanding the concept of sessions. So that is the level of my expertise in there. I went across a couple of frameworks, and I seriously dont have the patience of going through the entire django docs. So I stumbled across flask. The basic docs look cool, but I understand that in order to use it efficiently, I would have to use Werkzeug libraries.I dont know if I would be able to understand all those different components. That is why I thought that this would be the best place to get some suggestions if flask is something which will really help me understand things and would it be a good place to start off for a totally inexperienced and amateur like me!

A: 

I find diving into web frameworks a little daunting. If you would like to gain a firmer feeling for the nature of web development in general, I would opt for Tornado, as it is lightweight and easy to get started with.

Tornado documentation

zchtodd
But I believe Tornado does not support WSGI. Is that not the thing around which all web development in python supposed to be centred!(I might be very wrong...)
Alice
I'd go with Flask over Tornado. I'm not sure what the distinction between them is as far as "framework"ness goes, and Flask seems to have more momentum and better documentation, at the moment.
Will McCutchen
+3  A: 

If you are new to web development in Python then Flask is probably one of the best places to start - period, end of story.

It is still small enough that you can learn about WSGI from it's (excellent and extensively documented) source code -- and it's powerful enough, and has enough batteries included that you don't have to spend time trying to pick a good library to use for X or Y. (It includes bindings for Jinja2 by default and has a good extension for SQLAlchemy, for example.)

Django, and other large frameworks are daunting because they include all of the batteries up front (since you are working on a complex website with a deadline -- otherwise, why would you be using them) and are therefore a bit more difficult to pick up. Web.py and other really-micro-frameworks are daunting for the exact opposite reason -- they leave almost everything up to you (since you probably already know what you are doing and really just need the web framework to get out of your way.)

Flask does include everything you need to start building something more complex than a "Hello World" app -- it integrates a templating engine (Jinja2) for you so you don't have to decide whether you would be better off using Brevé, Genshi, Cheetah or Mako (though you could use any of the above if you wanted to). It does not include bash and .bat scripts to set up your project workspace, powerful web-based administrative management systems or an ORM so you can dive right in and start hacking without having to stop for 4 hours to read up on a new concept you had never heard of before.

Now, to be fair to all sides of the spectrum (Django and Web.py alike) they are all great systems for getting things done -- and once you've started learning you might find that you learn quicker with the leaner systems (like Web.py) or that you prefer the convenience of the full-stack frameworks (like Django). But for starting out, for learning the basics of WSGI and Python web development in particular and of dynamic web development in general, I do not know of any web framework that gives a better introduction to the concepts underlying it than Flask.

Sean Vieira
In case you cannot tell, I'm rather a Flask fanboy. :-)
Sean Vieira
Thanks Sean for that nice and detailed explanation. Will go ahead with flask rightaway.. any other suggestion that you could give about werkzeug libraries.(I believe to fully utilize the power of flask , you have to use Werkzeug Libraries, I might be wrong) also would be great if you could tell me if flask can be used to build facebook apps
Alice
@Alice: Flask is based on Werkzeug so yes, you need it but don't worry about it - everything is based on something :)
Hagge
Thanks Sean,Hagge,zchtodd,Will!
Alice
@Alice -- yes, you can use Flask to build a Facebook App - Facebook has a Python SDK that you would probably want to grab (rather than coding an interface yourself from scratch). It's at http://github.com/facebook/python-sdk/
Sean Vieira