I have created a Sample flet app and deployed to Azure App service using vs code.
To deploy flet app to Azure follow the below steps:
- Add the below line of code to the
main.py file.
ft.app(target=main, view=ft.AppView.WEB_BROWSER)
Below is complete code of my main. py file:
import flet as ft
def main(page: ft.Page):
counter = ft.Text("0", size=50, data=0)
def increment_click(e):
counter.data += 1
counter.value = str(counter.data)
counter.update()
page.floating_action_button = ft.FloatingActionButton(
icon=ft.Icons.ADD, on_click=increment_click
)
page.add(
ft.SafeArea(
ft.Container(
counter,
alignment=ft.alignment.center,
),
expand=True,
)
)
ft.app(target=main, view=ft.AppView.WEB_BROWSER)
- Run the below command to generate the
dist folder for deployment.
flet publish src/main.py
- While Creating Azure Web App, I selected
Runtime stack : Node 18 and Operating System : Windows.

- Deploy the
dist Folder to Azure as shown below.

Azure Output:
