Ask HN: Django or Flask as first web framework?
I have picked Python for fast web development and that is why I think I should just dive right into Django. However I have seen plenty of advice that it would be good to start with Flask(or other smaller framework) to learn better the inner workings of the framework.
What would you advise?
As I learn better from videos do you know of any good videos to learn the advised framework? What about books or tutorials?
What do you wish you knew or learn when you were just starting with the framework?
Thanks, Adrian
Update!!!
Thanks everyone for your comments. So I will be starting with Django and so far I have as resources Django docs and the upcoming video series. Is there anything else you would recommend as tutorials?
Asuming I am a fast learner and I learn this full time how long should it take before I can start building my own web apps?
15 comments
[ 4.5 ms ] story [ 37.5 ms ] threadI don't like learning from videos so can't help you there, but http://djangobook.com is awesome for learning Django, and the Flask documentation is sufficient too.
I understand this is an open source project but from the business perspective that notice is completely missplaced. The people looking there want to read the book and what they learn is that is outdated. The targeted audience that can actually help update the book most likelly hangs out somewhere else.
While I agree that a lot of what Django does seems like "magic", getting to know how that magic works as you get more intimate with the framework will make you a better developer in the long run - so you can start writing your own magic.
I would recommendation is django, but there currently are no good tutorials for it. Kenneth Love (https://twitter.com/kennethlove) is creating django video series that should be available in December.
In the meantime my recommendation is as follows:
1. Make sure you have an understanding of Python before you get into Django or Flask. Do this by taking one (or all) of the following online classes:
a. Udacity.com: http://www.udacity.com/overview/Course/cs101/CourseRev/apr20...
b. Learnpythonthehardway.org (There are video lessons for a price of $29)
c. https://www.edx.org/courses/MITx/6.00x/2012_Fall/about
2. Once you have an understanding of python and can write simple scripts, I recommend the following video courses for web development with Python:
a. Flask: http://www.youtube.com/user/calicoJake (A great Flask video tutorial series)
b. Udacity: http://www.udacity.com/overview/Course/cs253/CourseRev/apr20... (not flask or django, but still good)
c. Django: http://www.kickstarter.com/projects/657368266/getting-starte... (to be released in Dec 2012 or early 2013.
Flask is better suited to apps that are a) small and single-purpose, or b) highly nonstandard.
Django has a lot of stuff built right in, much of which you won't need. But it's nice to have a database abstraction, forms, auth, admin, etc. when you need them. Plus, it's practically a CMS already all by itself, with the nice admin panel.
I'd probably start with Django. The tutorial isn't bad at all: https://docs.djangoproject.com/en/1.4/intro/tutorial01/
The assertion that Flask gives you a better look under the hood is, in my opinion, incorrect. With Flask, you get almost nothing out of the box besides some basic URL routing and request handing. For most web development tasks, that's not enough. So you end up adding an ORM, a template engine, a session handling library, etc. on top. Eventually you end up with a set of libraries that have as much "magic" to them as your standard Django install, except now they're loosely held together by duct tape. Just take a look at SQLAlchemy, WTForms or Jinja2 -- three libraries that are often used with Flask -- and tell me whether they feel less like magic than Django's equivalents. Plus, now you have to look up documentation for three libraries in three different places, keep up with their developments separately, and get used to three different coding conventions. It gets complex very fast.
As adambard mentioned, Flask is a very effective tool when you want to do something highly nonstandard and rolling your own framework is your only option. For 9 out of 10 webapps, though, Django is the right answer.
In the end, you will learn the internals either way. If you start with Flask, you'll still have to learn about Django internals.
Start with Django (and you'll probably never switch to Flask).