I'm trying to load some Jinja2 templates from the Qt Resource System. I'm using Python 3.8.3, Jinja 2.11.2 and PyQt 5.15.
The problem is that I can't even detect the qrc paths to load the templates. QRC only works with Qt classes?
Python code:
from jinja2 import Environment, FileSystemLoader
file_loader = FileSystemLoader(":/plantillas/") # Here is my problem, how I should detect the qrc path?
env = Environment(loader=file_loader)
plantilla = env.get_template("base.md")
qrc:
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource prefix="plantillas">
<file alias="base.md">plantillas/base.md</file>
</qresource>
</RCC>
The QResource only works in the Qt world so a possible solution is to create a Loader using the Qt classes:
qloader.py