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() - > boolean

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
booleanTrue if an application context is currently active, allowing access to context proxies like current_app and g; otherwise False.