build.cgi 555 B

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/env python3
  2. import cgitb, json
  3. from jinja2 import Template, Environment, FileSystemLoader
  4. from acousticgender.library.settings import settings
  5. cgitb.enable()
  6. loader = FileSystemLoader(['./ui', './resources'])
  7. env = Environment(loader=loader)
  8. template = env.get_template('base.html')
  9. with open('./resources/themes.json') as f:
  10. themes = json.load(f)
  11. rendered = template.render(dev=settings['dev'], theme=themes['Deep Dark']);
  12. print("Content-type: text/html\n")
  13. print(rendered)
  14. with open('index.html', 'w') as f:
  15. f.write(rendered)