flet-dev / flet-dev/flet

Assets not loading on the web (ASGI-mode)

Open
#3,631 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: awaiting response
Dominant language
Python
Stars
17k
Forks
694
Avg merge
1d 14h
Merged PRs (30d)
33

Description

Duplicate Check
Describe the bug

Favicon and other images are not loading from assets directory, when deployed to web. Desktop version loads images normally.

Code sample
Logs Here is how my web app is being started:
app = ft.app(
        target=main,
        export_asgi_app=True,
        assets_dir="assets",
    )

In the app I simply use an ft.Image widget.

To reproduce

This bug only happens when I deploy my APP using ASGI (I am using hypercorn)

I am also deploying inside a Docker container

Expected behavior

I expected the app to be able to load the images in the assets directory as it does when alunched as a desktop app or a non-ASGI webapp.

Screenshots / Videos
Screenshots / Video demonstration

[Upload media here]

Operating System

Linux

Operating system details

Ubuntu 22.04

Flet version

0.22.1

Regression

I'm not sure / I don't know

Suggestions

No response

Logs
Logs
[Paste your logs here]
Additional details

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ASGI app setup using export_asgi_app, assets_dir, and ft.Image, then reproduce the failure by deploying with Hypercorn in the described Docker environment. Done means the favicon and other images load from the assets directory in ASGI mode as they do in desktop and non-ASGI web modes.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
backend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.