Skip to main content

run

Runs the Flet app.

Parameters:

  • main (AppCallable) - Application entry point. Handler (function or coroutine) must have 1 parameter of instance Page.
  • before_main (AppCallable | None, default: None) - Called after Page is created but before main.
  • name (str, default: '') - Page/app name used in web URL path when applicable.
  • host (str | None, default: None) - Host/IP to bind the web server to.
  • port (int, default: 0) - TCP port to bind. If 0, an available port is chosen when needed.
  • view (AppView | None, default: AppView.FLET_APP) - Preferred app presentation mode.
  • assets_dir (str | None, default: 'assets') - A path to app's assets directory.
  • upload_dir (str | None, default: None) - A path to a directory with uploaded files, or where uploaded files should be saved.
  • web_renderer (WebRenderer, default: WebRenderer.AUTO) - The type of web renderer to use.
  • route_url_strategy (RouteUrlStrategy, default: RouteUrlStrategy.PATH) - The strategy to use for generating URLs.
  • no_cdn (bool | None, default: False) - Whether not load CanvasKit, Pyodide, or fonts from CDN.
  • export_asgi_app (bool | None, default: False) - If True, returns a configured ASGI app instead of running an event loop.
  • target (default: None) - Deprecated alias for main.

Returns:

  • A FastAPI ASGI app when export_asgi_app=True. Otherwise, runs the app and returns None.