Search code examples
pyinstaller

404 Error while using Flask web app in PyInstaller executable


I have a web application based on Flask, when I run it from the script python my_script.py --web, it works well.

However after I package it using PyInstaller with pyinstaller my_script.spec and run it with .\my_script.exe --web, everything seems to work fine according to the log and the web application is opened at a port (checked with netstat)

But in browser it gives "404 Not Found"


Solution

  • I solved the problem. The app requires some part of the code in my frontend/dist folder. To run Flask application, we have to copy the code needed to the same path of the executable, which is copy frontend to dist\my_script