
The Flask Mega-Tutorial (2012) - Tomte
http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world
======
ryannevius
Miguel's Mega-Tutorial was invaluable to me when I was learning Flask circa
2011-2012. It's a great resource.

That said, IMHO, if you're going to implement a simple CRUD app in Python, you
may as well just use Django. Django includes all of the "batteries" for
handling forms, authentication, databases (the ORM), etc. right out of the
box. I think Flask has its place; but when it becomes a simple
reimplementation of Django, I'm not sure I see the point.

~~~
geezerjay
If people want "batteries included" solutions then nowadays they are better
off going with spring or ASP.NET Core.

~~~
collyw
Why? I use Django and its pretty good.

------
ksahin
This Github project "Flask-base" is great to start a flask project :
[https://github.com/hack4impact/flask-
base](https://github.com/hack4impact/flask-base) Lots of things are included,
user management/permissions / redis / SQLAlchemy ...

~~~
jimnotgym
This is really good! I must have a play...

------
diminoten
The link says it's from December 5th, 2017, so not 2012. Probably worth
changing in the title here on HN.

[https://www.kickstarter.com/projects/1124925856/the-new-
and-...](https://www.kickstarter.com/projects/1124925856/the-new-and-improved-
flask-mega-tutorial/posts/2097108)

Thanks 'windexh8er for mentioning something in the first place.

------
guitarbill
one thing i always see glossed over is using application factories [0]. they
are a bit harder to grok initially, since you have to hook your dependencies
up via the factory, but they really help with testing/deploryment and scaling
up flask apps. it's so much easier to do it at the start than to try and
retro-fit it. similarly, blueprints from day 1 also make sense.

[0]
[http://flask.pocoo.org/docs/1.0/patterns/appfactories/](http://flask.pocoo.org/docs/1.0/patterns/appfactories/)

~~~
diminoten
I've been using Flask for a few years now, and the other day had to whip up a
small app for a task at work. This is the first app I've used Blueprints and
Application Factories, so I'm looking forward to better understanding their
payoff in the future.

~~~
cirgue
Do you know of a good side-by-side comparison of a simple app built with
blueprints versus one without? I am still trying to wrap my head around the
problem that they solve.

~~~
guitarbill
thing is, a simple app won't show you the benefits. blueprints are basically
modules, and allow you to compose a big flask app from multiple blueprints. so
as your app grows, you can add new features sanely (especially routing). a
nice side-effect is having to think as features being correctly separated.

initially, it's only a bit more effort, but as you scale it'll stop e.g. your
views.py getting out of control, without resorting to hackery.

again, it can be hard to do retro-actively, and once you realize you need it,
the codebase is usually pretty bad. so i just do it from the start, as the
extra effort is small then.

(best practices prevent team members with less experience from committing
attrocities and give them a good foundation to copy from)

------
reacharavindh
Those interested in Flask may be interested in Quart (Flask compatible, but
faster because of Asyncio)

[https://pgjones.gitlab.io/quart/index.html](https://pgjones.gitlab.io/quart/index.html)

~~~
ergo14
Asyncio does NOT make applications faster, especially if you are CPU bound.

~~~
reacharavindh
But, most web applications are IO bound... dashboards, CRUD apps, simple
wrapped up API calls etc.

For a truly CPU bound application, you ought to be looking at something other
than Python IMHO.

------
jimnotgym
I feel like I should mention Miguel's book.

It builds a similar kind of application. I would say it is complimentary. It
is not as deep as, say, the Goat Book is on Django.

[https://flaskbook.com/](https://flaskbook.com/)

------
whitehouse3
I maintain a mid-sized (5000 LOC) Flask web app. Miguel’s mega-tutorial is
required reading for new dev’s coming onboard the project.

------
bl4ckm0r3
This was such a life changer when learning flask! I wish all the techs had
such a complete and well explained tutorial for beginners.

------
Beefin
This is the tutorial that first taught me flask and the reason it’s my
preferred backend framework today. Go Miguel!

------
mjsaah
I've been using this as a reference while building a webapp with flask. It's
been treating me very well.

~~~
windexh8er
It's also not from 2012. Miguel did a major rewrite last year that was crowd
funded. This is the updated guide.

~~~
suprfnk
Yes, this should have a (2017) tag, not (2012).

------
imeron
Is this mega tutorial format better than the current trend of video courses?
Do you guys have a preference?

~~~
suprfnk
I really dislike video courses. There is, usually, no good way to quickly scan
for the important parts.

If there is stuff you already know, skipping forward minutes will keep you
wondering whether you have missed something important. With text you can scan
through unimportant parts relatively easy, while knowing you didn't miss
something important.

------
chauhankiran
Anybody know something similar on Node.js, Express or MEAN?

~~~
thekdude
[https://devcenter.heroku.com/articles/mean-apps-restful-
api](https://devcenter.heroku.com/articles/mean-apps-restful-api)

This tutorial helped me get started when I needed to build a MEAN webapp for a
project

