-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_output.py
More file actions
31 lines (24 loc) · 806 Bytes
/
Copy pathcreate_output.py
File metadata and controls
31 lines (24 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from jinja2 import Environment, FileSystemLoader
from os import path, makedirs
directory_name = "outputs/"
file_name = "report.html"
file_path = directory_name + file_name
# Content to be published
content = "Hello, world!"
# Configure Jinja and ready the template
env = Environment(
loader=FileSystemLoader(searchpath="templates")
)
template = env.get_template("report.html")
def main(report):
"""
Entry point for the script.
Render a templates and write it to file.
:return:
"""
if not path.exists(directory_name):
makedirs(directory_name)
with open(file_path, "w+") as f:
f.write(template.render(event_name=report.event_name, event_year=report.event_code[:4], team_infos=report.team_infos, report=report))
# if __name__ == "__main__":
# main()