import os from jinja2 import Template wd = os.path.dirname(os.path.abspath(__file__)) # working directory # read template files with open(os.path.join(wd, '../templates/scatch.html')) as document_html: template = Template(document_html.read()) imgs_list = ['images/01.jpg', 'images/02.jpg', 'images/03.jpg'] template_render = template.render(title=':) Hello Sandra', imgs=imgs_list ) print(template_render)