The Flask Application Factory: Why Your Global App Object is Holding You Back
The global app = Flask(__name__) pattern freezes configuration at import time and leaks state between tests. Here is how the Application Factory pattern fixes it with create_app() and deferred extension binding.