I'm trying to call an external module to get a template rendered. The external module uses Jenja2 environment to render the template.
The code in the external module looks something like this:
def get_content():
_jinja_env = Environment(
loader=PackageLoader('mypkg'))
content = _jinja_env.get_template("foo.html").render()
return content
However, when I try to call get_content() from my Python module, the _jinja_env could not find the foo.html file. It looks like the _jinja_env's module path was pointing to my Python module instead. Is there a way to work around this issue?
One solution I can think of is to use gitsubtree instead of using the Python module way, but hopefully there is a better way than that.