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: str
) - > 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 to search within for the application.
app_namestrThe name of the Flask application, which can be a variable name or a function call string (e.g., 'app' or 'create_app()').

Returns

TypeDescription
FlaskThe Flask application instance.