Miguel Grinberg
blog.miguelgrinberg.com · Personal blog · on HN since 2012
Miguel Grinberg writes Python and Flask tutorials, plus posts on web performance, async Python, and generative AI coding tools.
What HN saysCommenters recommend the Flask Mega-Tutorial as a hands-on way to build a real app, and some say they used it years ago.
94HN people shared it
46linked it in comments
106stories submitted
3.0Kstory points
3 months agolast shared
2012people per year2026
Most-shared posts
- 1The Flask Mega-Tutorial37 people · 690 points · first shared 2012 · 87 comments on HN
- 2Ignore All Web Performance Benchmarks, Including This One – Miguelgrinberg.com8 people · 13 points · first shared 2020 · 1 comments on HN
- 3Python 3.14 is here. How fast is it?3 people · 842 points · first shared 2025 · 557 comments on HN
- 4Generative AI coding tools and agents do not work for me3 people · 405 points · first shared 2025 · 450 comments on HN
- 5Designing a RESTful API with Python and Flask3 people · 17 points · first shared 2013 · discussion on HN
- 6Using JavaScript-style async promises in Python3 people · 9 points · first shared 2021 · discussion on HN
- 7Easy WebSockets with Flask and Gevent3 people · 6 points · first shared 2014 · 1 comments on HN
- 8How LLMs Work, Explained Without Math2 people · 221 points · first shared 2024 · 91 comments on HN
- 9How to Make Python Wait2 people · 170 points · first shared 2019 · 31 comments on HN
- 10Sync vs. Async Python: What Is the Difference?2 people · 152 points · first shared 2020 · 112 comments on HN
- 11Microdot: Yet another Python web framework2 people · 98 points · first shared 2023 · 26 comments on HN
- 12Is Python That Slow?2 people · 41 points · first shared 2024 · 89 comments on HN
- 13Benchmarking MicroPython2 people · 22 points · first shared 2025 · 13 comments on HN
- 14It's Time for a Change: Datetime.utcnow() Is Now Deprecated2 people · 20 points · first shared 2023 · 2 comments on HN
- 15CSRF Protection Without Tokens or Hidden Form Fields2 people · 16 points · first shared 2025 · 1 comments on HN
What HN people wrote when they linked it
warrenm · 2021-12-18
Here's one (of a few) I subscribe to: https://blog.miguelgrinberg.com
gverrilla · 2020-07-08
Maybe reverse-SEO would be good: list higher those sites with less SEO-complicance lol
I have an analogy:
I'm new to programming and have been trying to build a web app using python. I went through a lot of websites and youtube videos, and the most fancy-looking ones where more often than not incomplete or bad. When there was a video and the "youtuber" would hit me asking for subscription or like all the time, or fancy 3d animations etc, I would know quality of content itself probably wouldn't be very good. Not to my surprise, the best tutorial I have found features a guy with his webcam only, with nothing fancy at all - you might call it a sloppy "production", if you want, but it's far better than anything else I've seen! - and it was never a top ranked search for my queries oon google.
For anyone wondering, I'm talking about grinberg's mega-tutorial on flask (https://blog.miguelgrinberg.com).
atoav · 2025-01-06
I think this is all a bit like "here are the tools, this is a circle, now draw the rest of the owl".
Don't get me wrong, the docs are great. What I meant by that is that all the individual parts are well explained, but a framework is all about how you compose its parts — and that is described best by walking people through the thought-process of why to combine certain elements in a certain way and what behaviour you achieve by that as a result. Because in the end it is about the result.
A stellar example of this is Miguel Grinbergs Flask Mega-Tutorial: https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-he…
This bridges the gap between a good reference and a complex example project.
downrightmike · 2024-07-31
Soup to nuts, This is really good to actually make something rather than just study: https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-he… He has a react tutorial too, but I didn't get through that.
I will say that you should look at your local community college and see if they have programming classes. They are usually cheap, taught by retired working professionals and more hands on with smaller class sizes. If you want programming to click easier, this would be my actual recommendation.
ijustwanttovote · 2023-11-14
> https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial...
Wow I practiced programming with that tutorial years ago, it's amazing people still reference it.
georgespencer · 2023-11-14
I can't speak highly enough of Miguel Grinberg's work with Python/Flask (https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-he… and the community he's created around it, for both beginners and advanced folks.
Racing through his mega tutorial was a great refresher for me on the fundamentals, and it's easy to plug in computer vision & related libraries/extensions/packages.
stefanvdw1 · 2022-04-04
Flask is what really got me in full stack web dev. Easy enough to start with and powerful enough for real products!
I can not recommend Miguel Grimberg’s Flask Mega-Tutorial[1] enough for beginners and novices. It is a bit more full stack focused, so if you are looking to use it for an API I’ve been maintaining a basic example [2].
1. https://blog.miguelgrinberg.com/post/flask-mega-tutorial-update-flask-…
2. https://github.com/StefanVDWeide/flask-api-template
Chris2048 · 2021-10-15
To be fair, I'm familiar with Flask and (some) of its complimentary modules. FastAPI has a lot of buzz right now, but it's also fairly new - I'll probably experiment with it first.
Also, I think that Django is a good choice over Flask if you've never done anything in flask. But if you have an existing Flask site that can serve as a skeleton, I think it's just as good as Django as a starting point; details such as code structure and common library choice is then already handles - in fact just following https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-he… will get you a lot of this too; Do you have any other batteries in mind? Ialso see Django having plenty "gotchas" (although it maybe have changed since I last used it). I definitely much prefer SQLAlchemy over DjangoORM.
wilsonfiifi · 2020-08-17
Another great resource for micropython tutorials is Miguel Grinberg’s blog [0]. In fact his blog is a gold mine for Flask development as well.
[0] https://blog.miguelgrinberg.com/category/MicroPython
aikah · 2018-08-28
To me, every framework or web oriented language out there should have a big tutorial similar to
https://railstutorial.org/book
because it covers a lot of things regarding classic everyday web development which is extremely useful to beginners. So just for the existence of that book I'd say yeah, Rails is still relevant.
There is also this one for flask which builds an web app from start to finish for people who like Python.
https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-he…
A lot of ruby books features the design and development of complete medium sized application from start to finish in various domain.
That's the kind of thing beginners should learn instead of 'Docker' or 'React' because they've heard everybody constantly talking about the latter.
mod · 2017-02-16
Django has good tutorials, I don't know about building "one app" though. I'm sure you can find some of lesser quality; Hartl's tutorial is one of the very best.
If you don't mind drawing out your learning process, you could walk through Hartl's tutorial and do the equivalent in Python (probably with much help from google). So you couldn't use his code examples, but you could set up the same DB structure, the same types of tests, etc, and hit all the important parts of the web dev process.
Edit: found this in another comment below. Just thought I'd include it in case you gloss over it! https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-he…
superquest · 2017-02-16
Miguel Grinberg's "Flask Web Development" [1] is an excellent introduction Python-based web development. You build a Twitter-clone. The book is an adaptation of the authors 18-part tutorial on the same topic [2].
[1] http://shop.oreilly.com/product/0636920031116.do
[2] https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-he…
elbigbad · 2016-02-21
This is great. For anyone interested in learning further, this is basically considered the Flask bible:
http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hel…
ytjohn · 2015-09-08
For my headless Pis, I attach a BT TTL serial port to the rx/tx pins. They run about $15 or less. This lets me pair to the serial port from my laptop, watch it boot the kernel, login and do whatever cli commands I need. I can also use BlueTerm on my android phone to do the same thing (though make sure you get the hacker keyboard if you go this route).
Here's pretty much the article I followed, though I bumped my console up to 115200. http://blog.miguelgrinberg.com/post/a-cheap-bluetooth-serial-port-for-…
alceta · 2014-05-04
I very much enjoyed the author's Blog series on a blog written in Flask [1]. I did not (yet) buy and read the book, but from his style on the blog, I can only assume it is a great resource on Flask.
[1] http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hel…
jbeja · 2014-04-13
You should recommend to your friend this tutorial, that it how i learned flask: http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hel…
mercnet · 2013-12-10
Since you want to learn python and web development here is an awesome tutorial for Flask: http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hel…
I also recommend checking out codeschool/codeacademy for tutorials related to the web.
hnisoss · 2023-09-25
1. This can be learned in one month.
2. Follow official docker docs, deploy tutorial containers.
- learn both docker, swarm and compose
- learn about networking, volumes and secrets (focus here, this is the most important part)
- take notes and don't spend more than a week on this
3. Then deploy some open source services based on docker, find them on github (i.e. azuracast). Spend whole week deploying docker stacks, find as complex as possible if you find it easy.
4. Now repeat the process for k8s.
- setup local stack (pick k3s or kind, don't overthink it)
- read about basic k8s concepts on the website (this should map to what you know from docker)
- deploy few basic containers (pods)
- then find k8s stacks on github to deploy
- take notes, week max
5. In the final week try to convert one of you docker stacks to k8s to learn the differences and to write your own charts. Dont rely on tools like kompose - do it by hand.
- here try to learn to write own charts
- if you have time left learn one of the cloud offerings (ie GKE)
Suggestion: If you know python try to deploy this for starters https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xix-…
fbdab103 · 2023-02-24
I will take a well curated package that handles all the problems for me rather than bolting together pieces just so I can feel more ownership of a project.
- Admin panel? Django has me
- Web forms? Django has me
- Testing? Django, again has an out of the box solution
- Latest in security practices[0]? Again, covered for free
Flask, boy oh boy. I want an ORM? Guess I have to search around, Flask-SQLAlchemy has a lot of hits, I guess? Emails? Well, the Flask Mega-Tutorial uses Flask-Mail[1], guess I will use that. Oh look, it has not been updated since 2014[2]. Hope there is not a security flaw in there[3].
Django follows best practices, and has a huge community ensuring that there is adequate coverage and features required for modern development.
[0]: https://docs.djangoproject.com/en/4.2/releases/4.2/ note on the BREACH attack
[1]: https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-x-em…
[2]: https://github.com/mattupstate/flask-mail
[3]: https://github.com/mattupstate/flask-mail/issues/189
imauld · 2017-12-24
In my opinion Java is great if you want to write big enterprise-y applications but if you just want to get something done or just learn some concepts I would suggest Python. You can do all the same things you can do with Java as a beginner and it will mostly stay out of your way. Python also doesn't require a build system like Java does. You can just write some Python in a plain old text editor and run it without too much trouble. Java on the other hand will require a build system and a full IDE.
IMO with all the other languages available Java just doesn't really offer anything special enough to warrant it's dealing with it's awkward type system and verbosity. Unless you want to do something with Java specifically like Android dev it just doesn't offer anything worth the pain. If want higher performance and the type safety that Python doesn't have I prefer Go. It's syntax is very similar to Python and it has some interesting concepts.
Whatever you choose don't choose based off hype/promises of jobs. Most companies will hire engineers who have never used the language(s) in their stack as long you can demonstrate knowledge of core programming concepts. Python's `list`, Java's `ArrayList` and Go's `slice` might have some slight differences in implementations and different warts and what have you but deep down they are arrays. If you are familiar with the data structures and algorithms core to programming you can learn to use any language to solve problems.
At the end of the…
SmellTheGlove · 2017-04-07
Great topic. We sound a lot alike. I work in a different sector, but I'm also now squarely in management and have been for a while, and my previous expertise was data engineering and infrastructure. Started with zero front end ability, and also not much Python either since I'm in the size of company and industry that still accomplishes most data work in SAS, and what it can't, Informatica and DataStage. Here's where I'm at, and so as to not bury the lede, I'm not making money yet but I found satisfaction in just spending some time each week on my projects -
1. If you know python, you can probably make a pretty natural jump to Flask. I didn't know Python, but I could program in a handful of other languages, so I figured I'd pick it up as a useful tool anyway. You may like this tutorial:
https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-he…
I'd say I really started learning when I got to the stage on authentication. The reason is that this tutorial implements OpenID, which isn't very common anymore, so I went off and implemented OAuth instead - heavily googling and scavenging, but ultimately having to piece together something that worked myself. I learned a lot that afternoon.
You could do this with any framework and there are tons of them. I chose Python and Flask over a Javascript-based framework because learning Python in parallel would be useful to me in data engineering, even though I don't write code for a living anymore.
2. As…
cat9 · 2015-05-22
You work in Python & you want simple web interfaces?
Flask. Check out the docs, it's about as simple and pythonic as it's possible for "respond to this URL by executing that python function" to be.
http://flask.pocoo.org
Talking to relational databases is mostly handled through Flask-SQLAlchemy, which isn't much more complicated to get started with, but SQLAlchemy is very open-ceiling in terms of power and utility.
http://flask-sqlalchemy.pocoo.org/2.0/
Miguel Grinberg's tutorial is solid for a broader view of common app features, and will likely cover more than you'll need any time soon.
http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hel…
If you want to integrate JavaScript stuff, whether full apps or jQuery or D3.js or what have you, worry about that later - it might not be necessary, but it's fairly easy to bolt on if needed.
---------
JavaScript & CSS assets:
I use Gulp, which is a JavaScript build tool, to build my JavaScript & CSS assets. This isn't something you can pip and done, but it's probably worth the effort if you get to the point of having extensive JavaScript & CSS files. If that sounds like a hassle, use Flask-Assets.
Why? The JavaScript tools for dealing with JavaScript are much less of a hassle, and for whatever reason they also tend to have less fussy CSS asset builders. But this is mostly a "set up the script once & forget about it outside of letting it run" problem, so it's not really a hassle to use in place of…
amanzi · 2025-12-04
The way it's typically done is that the worker process reports back its progress to the job metadata on the queue, and the web worker polls the job metadata to read the progress. I've implemented this for progress bars many times on Django with django-rq.
I first learned about it from Miguel Grinberg's Flask tutorial: https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xxii… But the same concept applies to Django.
jacobtomlinson · 2025-10-10
Same! This tutorial from 2012 was one of the first things I did in Python. Coming from PHP it was so refreshing. https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-he…
simpaticoder · 2025-09-07
Yes, I also wanted to comment on the benchmark article[1], because it seems you looked at compute-bound performance rather than rps (requests per second) on simple data. Given that what you made, MicroDot, is a web server, it would make more sense to stress it rather than MicroPython and the SoC, no? That would seem to be more of the purview of the MicroPython and/or SoC devs.
1 - https://blog.miguelgrinberg.com/post/benchmarking-micropython
ab_testing · 2024-07-20
If you are using python and flask for building the web application, then there is a well defined tutorial on implementing user login and password.
https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-he…
cpach · 2022-11-12
This might be a good starting point:
The Flask Mega Tutorial https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-he…
I’m guessing there’s something similar for Ruby on Rails and Laravel.
For persistence, consider Litestream/SQLite. Or just good old PostgreSQL. Or MariaDB.
smt88 · 2022-06-19
Don't worry about your deployment being directly related to your dev environment. That's a good goal, but most people make do without it.
You can use Vagrant or Docker[1] locally and then deploy somewhere easy like Render.com[2][3].
Since you're new to fullstack, you may have an easier time with Next.js (definitely use the TypeScript option) because then you're only learning/using a single language in a single repository for both frontend and backend.
1. https://blog.miguelgrinberg.com/post/how-to-dockerize-a-react-flask-pr…
2. https://render.com/docs/deploy-flask
3. https://render.com/docs/deploy-create-react-app
miguelgrinberg · 2022-05-30
This is really a matter of preference. I do not use Flask-Admin on my projects, I have always preferred to design my own admin pages than being forced to accept the choices that are imposed by these big extensions. This allows me to have a consistent UI across admin and non-admin pages.
One thing that people often complain is that it is hard and/or tedious to build tables with data, which is one of the building blocks most admin pages need. Last year I wrote a blog article where I show how I build tables in my Flask apps: https://blog.miguelgrinberg.com/post/beautiful-interactive-tables-for-…