Skip to main content

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

AttributeTypeDescription
app_import_path`strNone` = None
create_app`t.Callable[..., Flask]None` = None
datadict[t.Any, t.Any] = {}A dictionary with arbitrary data that can be associated with this script info.
set_debug_flagbool = TrueDetermines whether the application's debug flag should be updated based on the environment during the app loading process.
load_dotenv_defaultsbool = TrueWhether default .flaskenv and .env files should be loaded.
_loaded_app`FlaskNone` = 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

NameTypeDescription
app_import_path`strNone` = None
create_app`t.Callable[..., Flask]None` = None
set_debug_flagbool = TrueWhether to set the debug flag on the loaded application.
load_dotenv_defaultsbool = TrueWhether 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

NameTypeDescription
app_import_path`strNone` = None
create_app`t.Callable[..., Flask]None` = None
set_debug_flagbool = TrueWhether to automatically set the application's debug flag based on the environment.
load_dotenv_defaultsbool = TrueA 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

TypeDescription
[Flask](../app/flask.md?sid=src_flask_app_flask)The loaded Flask application instance, cached for subsequent calls.