Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def build_index():
lookup = TemplateLookup(directories=[TEMPLATE_DIR])
template = Template(
filename=TEMPLATE_DIR + '/index.html', lookup=lookup)
page = 1
perpage = 5
entries = Entry.get_published_page(page)
total = len(Entry.get_all_published())
html_content = template.render(
entries=entries, total=total, page=page, perpage=perpage)
dist = os.path.join(BASE_DIR, 'index.html')
with codecs.open(dist, 'w', 'utf-8-sig') as f:
f.write(html_content)