3 ms·
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 Appl
by diminoten 8y ago
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 8y agoDo 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 8y agothing 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)