Frappe.render_template custom template folder

When I want to use frappe.render_template for my custom html template,

                with open(model_path, 'wb') as f:
                                                   self.app_context, is_path=True).encode('utf-8'))

I receive:

jinja2.exceptions.TemplateNotFound: templates/autodoc/my_html.html

If I give full path to this folder, I receive the same error:

jinja2.exceptions.TemplateNotFound: /home/emil/Desktop/frappe-bench/apps/{*name_of_app*}/{*name_of_app*}/templates/autodoc/my_html.html

My templates folder contain by path:

Which problems can be? How I can directly point the template directory for render_template function?

I have same question!
did you find any helpful reference?

I wrote function, that can do the same logic for it.

    def render_autodoc(self, template, doc_path, context=None):
        """ Render doc from templates folder """
        if context:
            context = self.app_context
        with open(os.path.join(self.autodoc_path, template), 'r') as f:
            content = frappe.render_template(, context=context)
        with open(doc_path, 'w') as f:

It is very useful, that render_template can accept string with raw_html code as parameter

1 Like