Structuring huge and scalable projects
Creating a directory structure for a simple Flask web application is very handy and easy, especially if there is only one module to build with few software features. But for complex and scalable enterprise-grade applications with an overwhelming number of features to support, the most common issue is always the circular import problem.
Important note
A circular import problem happens when two or more modules import each other, creating a mutual dependency loop before the application’s full-blown execution. This scenario always causes unexpected application loading errors, missing modules, and even weird runtime problems.
Flask as a framework is very Pythonic, which means developers can decide on their approaches to structuring their applications. Unfortunately, not all directory structure designs push through due to circular import problems. However, three design patterns can provide a baseline structure for Flask projects: the...