Flet Environment Variables

Overview

Environment variables provide configuration for Flet applications. They control various aspects of application behavior, logging, storage, and deployment.

Environment Variables List

  • **FLET_APP_CONSOLE**: Path to the application's console log file (console.log) in the temporary storage directory. Set in production mode.
  • **FLET_APP_STORAGE_DATA**: Directory for persistent application data, preserved between updates. Pre-created.
  • **FLET_APP_STORAGE_TEMP**: Directory for temporary application files (cache). Pre-created.
  • **FLET_ASSETS_DIR**: Absolute path to the app's "assets" directory. Defaults to "assets".
  • **FLET_CLI_NO_RICH_OUTPUT**: Disables rich output in the console. Defaults to "false".
  • **FLET_PLATFORM**: The platform the application is running on. Possible values: "android", "ios", "linux", "macos", "windows", "fuchsia".
  • **FLET_CLI_SKIP_FLUTTER_DOCTOR**: Skips running flutter doctor on build failure. Defaults to False.
  • **FLET_FORCE_WEB_SERVER**: Forces running the app as a web app. Automatically set on headless Linux hosts.
  • **FLET_OAUTH_CALLBACK_HANDLER_ENDPOINT**: Custom path for OAuth handler. Defaults to "/oauth_callback".
  • **FLET_OAUTH_STATE_TIMEOUT**: Maximum time (seconds) to complete OAuth web flow. Defaults to 600.
  • **FLET_MAX_UPLOAD_SIZE**: Maximum allowed size (bytes) for uploaded files. Default is unlimited.
  • **FLET_SECRET_KEY**: Secret key to sign temporary upload URLs.
  • **FLET_SERVER_IP**: IP address to listen on for web apps. Defaults to 0.0.0.0 (all IPs).
  • **FLET_SERVER_PORT**: TCP port for the app. Defaults to 8000 on Linux servers or when FLET_FORCE_WEB_SERVER is set; otherwise, a random port.
  • **FLET_SERVER_UDS_PATH**: Unix Domain Socket (UDS) path for the Flet server on Unix-based systems (e.g., flet_.sock).
  • **FLET_SESSION_TIMEOUT**: Session lifetime in seconds. Defaults to 3600.
  • **FLET_UPLOAD_DIR**: Absolute path to the app's "upload" directory.
  • **FLET_UPLOAD_HANDLER_ENDPOINT**: Custom path for upload handler. Defaults to "/upload".
  • **FLET_WEB_APP_PATH**: URL path to host the web app under. Defaults to / (root).
  • **FLET_WEBSOCKET_HANDLER_ENDPOINT**: Custom path for WebSocket handler. Defaults to "/ws".
  • **FLET_WEB_RENDERER**: Web rendering mode. Options: "canvaskit" (default), "html", "auto".
  • **FLET_WEB_USE_COLOR_EMOJI**: Enables loading web font with colorful emojis. Accepts True, true, or 1.
  • **FLET_WEB_ROUTE_URL_STRATEGY**: Web application URL strategy. Options: "path" (default) or "hash".
  • Setting Boolean Values

    Boolean True is represented by the strings: "true", "1", or "yes". Any other value is interpreted as False.