ScriptInfo
Helper object to deal with Flask applications. This is usually not necessary to interface with as it's used internally in the dispatching to click. In future versions of Flask this object will most likely play a bigger role. Typically it's created automatically by the :class:FlaskGroup but you can also manually create it and pass it onwards as click object.
Attributes
| Attribute | Type | Description |
|---|---|---|
| app_import_path | `str | None` |
| create_app | `t.Callable[..., Flask] | None` |
| data | dict[t.Any, t.Any] | A dictionary with arbitrary data that can be associated with this script info. |
| set_debug_flag | bool | This attribute determines whether the debug flag of the loaded Flask application should be set based on the environment. |
| load_dotenv_defaults | bool | Whether default ".flaskenv" and ".env" files should be loaded. |
| _loaded_app | `Flask | None` |
Constructor
Signature
def ScriptInfo(
app_import_path: str | None = None,
create_app: t.Callable[..., [Flask](../app/flask.md?sid=flask_app_flask)]| None = None,
set_debug_flag: bool = True,
load_dotenv_defaults: bool = True
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| app_import_path | `str | None` = None |
| create_app | `t.Callable[..., Flask] | None` = None |
| set_debug_flag | bool = True | Whether to set the debug flag on the Flask application. |
| load_dotenv_defaults | bool = True | Whether default .flaskenv and .env files should be loaded. ScriptInfo doesn't load anything, this is for reference when doing the load elsewhere during processing. |
Methods
load_app()
@classmethod
def load_app() - > [Flask](../app/flask.md?sid=flask_app_flask)
Loads the Flask app (if not yet loaded) and returns it. Calling this multiple times will just result in the already loaded app to be returned.
Returns
| Type | Description |
|---|---|
[Flask](../app/flask.md?sid=flask_app_flask) | The loaded Flask application instance. |