Skip to main content

has_app_context

Test if an app context is active. Unlike :func:has_request_context this can be true outside a request, such as in a CLI command.

def has_app_context() - > bool

Test if an app context is active. Unlike :func:has_request_context this can be true outside a request, such as in a CLI command.

Returns

TypeDescription
boolTrue if an application context is currently active, allowing access to context proxies like g and current_app; otherwise False.