locate_app
Imports a specified module and attempts to locate a Flask application instance within it, either by searching for a specific name or using a discovery heuristic. It raises a NoAppException if the module cannot be imported or the application cannot be found, unless configured otherwise.
def locate_app(
module_name: str,
app_name: str | None,
raise_if_not_found: bool = True
) - > Flask | None
Attempts to import a module and locate a Flask application instance within it, either by a specific name or by searching for the best candidate.
Parameters
| Name | Type | Description |
|---|---|---|
| module_name | str | The fully qualified name of the Python module to import and search for the application. |
| app_name | `str | None` |
| raise_if_not_found | bool = True | Determines whether to raise a NoAppException or return None if the specified module cannot be imported. |
Returns
| Type | Description |
|---|---|
| `Flask | None` |