Skip to content

Comment on Ask HN: Django or Flask as first web framework?

Comments

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.

I agree completely. However, personally I am using Flask only because tacking SQLAlchemy on top of Django feels so hacky. I wish there was a second full stack framework with SA.

Have you given Pyramid a look?

The core Pyramid setup is actually just as minimal as Flask is. You need to add a million different Pyramid_ addons to get "full stack" functionality.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.