Our application has gone from a very simple example to an extendable foundation on which powerful features can easily be built. However, having our application entirely reside in one file needlessly clutters our code. This is one of the advantages of Flask; you can write a small REST service or web application on a single file, or a full-blown enterprise application. The framework won't get in your way and won't impose any project layout.
To make the application code clearer and more comprehensible, we will transform the entire code into a Python module and each feature into a module by itself. This modular approach enables you to scale easily and in a predictable way, so new features will have an obvious place and structure. In this chapter, you will learn the best practices for the following:
- Creating a modular application that easily...