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` = None |
| create_app | `t.Callable[..., Flask] | None` = None |
| data | dict[t.Any, t.Any] = {} | A dictionary with arbitrary data that can be associated with this script info. |
| set_debug_flag | bool = True | Determines whether the application's debug flag should be updated based on the environment during the app loading process. |
| load_dotenv_defaults | bool = True | Whether default .flaskenv and .env files should be loaded. |
| _loaded_app | `Flask | None` = None |
Constructor
Signature
def ScriptInfo(
app_import_path: str | None = None,
create_app: t.Callable[..., [Flask](../app/flask.md?sid=src_flask_app_flask)]| None = None,
set_debug_flag: bool = True,
load_dotenv_defaults: bool = True
) - > None
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 loaded application. |
| load_dotenv_defaults | bool = True | Whether default .flaskenv and .env files should be loaded. |
Signature
def ScriptInfo(
app_import_path: str | None = None,
create_app: t.Callable[..., [Flask](../app/flask.md?sid=src_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 automatically set the application's debug flag based on the environment. |
| load_dotenv_defaults | bool = True | A flag indicating if standard .env and .flaskenv files should be processed during the loading sequence. |
Methods
load_app()
@classmethod
def load_app() - > [Flask](../app/flask.md?sid=src_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=src_flask_app_flask) | The loaded Flask application instance, cached for subsequent calls. |