The application context in Flask provides access to app-level data like configuration and resources. It allows code to access the current app instance globally during a request.
Accessing current_app outside an application context causes Flask to raise a RuntimeError because it does not know which app instance to refer to.
Inside the app.app_context() block, current_app.name prints the app's name, which is usually __main__ when run directly. Then 'Done' prints after the block.
The correct way is to create the context object with app.app_context(), then call push() and pop() on it.
The error occurs because print_app_name() tries to access current_app without an active application context. The context must be pushed manually or via a request.
