Skip to main content

find_app_by_string

Check if the given string is a variable name or a function. Call a function to get the app instance, or return the variable directly.

def find_app_by_string(
module: ModuleType,
app_name: string
) - > Flask

Check if the given string is a variable name or a function. Call a function to get the app instance, or return the variable directly.

Parameters

NameTypeDescription
moduleModuleTypeThe Python module object where the application instance or factory function is defined.
app_namestringThe name of the attribute to retrieve or a function call string (e.g., 'create_app()') to execute within the module.

Returns

TypeDescription
FlaskThe resolved Flask application instance extracted from the module attribute or factory function.