You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
560 B
Python
30 lines
560 B
Python
from jinja2 import Environment, PackageLoader, select_autoescape
|
|
import json
|
|
import http.server
|
|
import socketserver
|
|
|
|
|
|
|
|
def main():
|
|
|
|
with open('contents.json', 'r') as f:
|
|
contents = json.load(f)
|
|
|
|
|
|
# generate the template
|
|
|
|
env = Environment(
|
|
loader=PackageLoader("postit"),
|
|
autoescape=select_autoescape()
|
|
)
|
|
|
|
|
|
template = env.get_template('postit.html')
|
|
render = template.render(contents=contents)
|
|
|
|
with open(f'test/posti.html', 'w') as output:
|
|
output.write(render)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main() |