@todianedev Taking a quick look at the Flask documentation here:
https://flask.palletsprojects.com/en/3.0.x/quickstart/
Flask seems to want to run a web server, so the issue would be explained in this thread:
https://answers.netlify.com/t/support-guide-can-i-run-a-web-server-http-listener-and-or-database-at-netlify/3078
You can use python during your build, but not at runtime.