Refactoring A Flask App to Scare

made and submitted by kellyfoulk
So you just created your first Flask application, what’s next? If you’re like me, your app works, but it’s like a baby deer that’s lost its mother—its chances of ever growing old and maturing are slim to none. Let’s fix that. In my opinion, it’s much easier to write something well from the start than it is to go back and fix something crappy; however, the best way to learn is by fixing your mistakes. Therefore, this post will not explain how to write a perfect Flask app from scratch; instead, it will highlight 12 mistakes I made while creating my first major Flask app, explain why these mistakes were prohibitive to growth, and demonstrate how I fixed them.