I currently have my main app.py app that I wanted to run in a standalone PyQT app instead of opening a new tab in the browser. Hence I have a gui.py file that does exactly that.
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtCore import QUrl
from threading import Thread
from werkzeug.serving import run_simple
from app import app as flask_app
class WebAppWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle('Flask')
self.setCentralWidget(QWebEngineView())
self.showMaximized()
self.start_flask_app()
url = QUrl('http://127.0.0.1:5000/')
self.centralWidget().load(url)
def start_flask_app(self):
flask_thread = Thread(target=self.run_flask)
flask_thread.daemon = True
flask_thread.start()
def run_flask(self):
run_simple('localhost', 5000, flask_app, use_reloader=False, use_debugger=False)
if __name__ == "__main__":
app = QApplication(sys.argv)
window = WebAppWindow()
sys.exit(app.exec_())
The issue however is that the app does not work (Image attached below) if I run python gui.py, returning the error:
(Background on this error at: https://sqlalche.me/e/14/e3q8)```
Yet it works if I run it normally through ```python app.py``` opening a new browser window. I've digged a little deeper into the stock flask template I've used (https://github.com/app-generator/flask-sb-admin/blob/master/apps/config.py)
Any help would be appreciated!

