using .qrc
With this method you will convert the files (.html, .css, .js, etc) into .py code using pyrcc5 for this you must follow the following steps:
2.1. Create a file called resource.qrc with the following content in the project folder:
index.html
jquery.js
my_custom.js
styles.css
2.2 Convert it to .py using pyrcc5:
pyrcc5 resource.qrc -o resource_rc.py
2.3 Import the resource_rc.py file and use the url with schema "qrc" in the main.py file:
import os
import sys
from PyQt5 import QtCore, QtWidgets, QtWebEngineWidgets
import resource_rc
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
view = QtWebEngineWidgets.QWebEngineView()
url = QtCore.QUrl("qrc:/index.html")
view.load(url)
view.show()
sys.exit(app.exec_())
2.4 Compile the project using your initial command
pyinstaller --onefile --windowed main.py