app
Classes#
Functions#
app
#
app(
main: Union[
Callable[[Page], Awaitable], Callable[[Page], None]
],
before_main: Union[
Callable[[Page], Awaitable], Callable[[Page], None]
] = None,
proxy_path: Optional[str] = None,
assets_dir: Optional[str] = None,
app_name: Optional[str] = None,
app_short_name: Optional[str] = None,
app_description: Optional[str] = None,
web_renderer: WebRenderer = AUTO,
route_url_strategy: RouteUrlStrategy = PATH,
no_cdn: bool = False,
upload_dir: Optional[str] = None,
upload_endpoint_path: Optional[str] = None,
max_upload_size: Optional[int] = None,
secret_key: Optional[str] = None,
session_timeout_seconds: int = DEFAULT_FLET_SESSION_TIMEOUT,
oauth_state_timeout_seconds: int = DEFAULT_FLET_OAUTH_STATE_TIMEOUT,
)
Mount all Flet FastAPI handlers in one call.
Parameters:
-
main(Union[Callable[[Page], Awaitable], Callable[[Page], None]]) –Application entry point. It is called for newly connected users. Handler (function or coroutine) must have 1 parameter of instance
Page. -
before_main(Union[Callable[[Page], Awaitable], Callable[[Page], None]], default:None) –Called after
Pagewas created, but before callingmain. -
proxy_path(Optional[str], default:None) –URL prefix when the app is mounted under a proxy.
-
assets_dir(Optional[str], default:None) –an absolute path to app's assets directory.
-
app_name(Optional[str], default:None) –PWA application name.
-
app_short_name(Optional[str], default:None) –PWA application short name.
-
app_description(Optional[str], default:None) –PWA application description.
-
web_renderer(WebRenderer, default:AUTO) –web renderer defaulting to
WebRenderer.AUTO. -
route_url_strategy(RouteUrlStrategy, default:PATH) –routing URL strategy:
path(default) orhash. -
no_cdn(bool, default:False) –do not load resources from CDN.
-
upload_dir(Optional[str], default:None) –an absolute path to a directory with uploaded files.
-
upload_endpoint_path(Optional[str], default:None) –absolute URL of upload endpoint, e.g.
/upload. -
max_upload_size(Optional[int], default:None) –maximum size of a single upload, bytes. Unlimited if
None. -
secret_key(Optional[str], default:None) –secret key to sign and verify upload requests.
-
session_timeout_seconds(int, default:DEFAULT_FLET_SESSION_TIMEOUT) –session lifetime, in seconds, after the user disconnected.
-
oauth_state_timeout_seconds(int, default:DEFAULT_FLET_OAUTH_STATE_TIMEOUT) –OAuth state lifetime, in seconds, which is the maximum allowed time between starting OAuth flow and redirecting to OAuth callback URL.