3

I have two projects: one of them is a Python Project with Fastapi and another one is a React project.

I've packaged my Python application into an Appimage, by creating a single binary for it (with pyinstaller) and then packaging it as an Appimage. This works fine on itself and the application behaves as it should.

I also want my React project inside the Appimage so that I can host it from Fastapi like this:

app.mount("/", StaticFiles(directory="./dist", html=True), name="static")

When running the Appimage though, I get an error that said directory doesn't exist. I've also tried combining it with __file__ to get the absoloute file path like this:

script_dir = os.path.dirname(os.path.abspath(__file__))
dist_dir = os.path.join(script_dir, "dist")
app.mount("/", StaticFiles(directory=dist_dir, html=True), name="static")

Which doesn't seem to work either.

What can I do to fix this?

Edit

This is the file structure of the AppDir

.
├── AppRun
├── fastapiappimage
├── fastapiappimage.desktop
├── fastapiappimage.png
└── dist
    ├── assets
    │   ├── favicon.30fbc9fb.svg
    │   ├── index.bb5ca6bb.js
    │   ├── index.f35051b3.css
    └── index.html
Lumberjack
  • 419
  • 6
  • 12
Computergy
  • 65
  • 1
  • 6

0 Answers0