Live data from Hacker News

Ask HN: Django or Flask as first web framework?

news.ycombinator.com

1–10 of 16 posts

Ask HN: Django or Flask as first web framework?

#1
I am in the process of learning Python for web development and I think I am the stage where I should start learning a web framework(did not use one before in another language). My html and css is ok.

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?

Re: Ask HN: Django or Flask as first web framework?

#2
Either one is great. I started with Django and now prefer Flask; unless you are starting out with an enormous project I agree with the recommendations you have received--you will get a better sense of what's happening under the hood with Flask.

I 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.

Re: Ask HN: Django or Flask as first web framework?

#3

Either one is great. I started with Django and now prefer Flask; unless you are starting out with an enormous project I agree with the recommendations you have received--you will get a better sense of what's happening under the hood with Flask. I 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.

Is the Django book updated? The notice where it asks for help to get it updated it scared me as a newcomer(and probably many others) as I won't know to judge if what I read is updated material or not.

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.

Re: Ask HN: Django or Flask as first web framework?

#4
I recommend Django because it's much more widely used. You'll find more write-ups, Stack Overflow questions, podcasts and conference videos. Instagram uses it. Disqus uses it. There's just a ton of help out there for a new developer.

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.

Re: Ask HN: Django or Flask as first web framework?

#5
post #4

I recommend Django because it's much more widely used. You'll find more write-ups, Stack Overflow questions, podcasts and conference videos. Instagram uses it. Disqus uses it. There's just a ton of help out there for a new developer. 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…

This is what puts Django on top of my list so far. It would be more fun and productive if I can just start doing web apps and I can always jump in and learn some of the magic behind it in the future.

Re: Ask HN: Django or Flask as first web framework?

#6
post #3

Either one is great. I started with Django and now prefer Flask; unless you are starting out with an enormous project I agree with the recommendations you have received--you will get a better sense of what's happening under the hood with Flask. I 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.

Is the Django book updated? The notice where it asks for help to get it updated it scared me as a newcomer(and probably many others) as I won't know to judge if what I read is updated material or not. 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 au…

I can't speak to the status of the Django Book, but Django's official documentation is up to date and just as (if not more) comprehensive. Version 1.4: https://docs.djangoproject.com/en/1.4/

Re: Ask HN: Django or Flask as first web framework?

#7
Hi Adrian,

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.

Re: Ask HN: Django or Flask as first web framework?

#8
Depends what you want to build.

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/

Re: Ask HN: Django or Flask as first web framework?

#9
You can never go wrong with Django. It comes with enough batteries included to get you up and running with complex projects quickly. Plus, there's a lively ecosystem of useful libraries built on top on Django that make complex tasks a breeze. If you want to built useful webapps quickly, Django is the way to go.

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.

Post reply on HN