surok/surok/templates.py

16 lines
285 B
Python
Raw Permalink Normal View History

2016-08-17 12:13:02 +03:00
from jinja2 import Template
2016-08-03 15:46:08 +03:00
import os
2016-08-01 14:56:35 +03:00
2016-08-17 12:13:02 +03:00
# Return rendered configuration
2016-08-01 14:56:35 +03:00
def gen(my, jj2):
2016-08-01 15:24:13 +03:00
f = open(jj2, 'r')
2016-08-01 14:56:35 +03:00
temp = f.read()
f.close()
template = Template(temp)
2016-08-04 13:16:06 +03:00
os.environ['APP_NAME'] = my['conf_name']
2016-08-03 15:46:08 +03:00
my['env'] = os.environ
2016-08-01 14:56:35 +03:00
2016-08-01 15:24:13 +03:00
return template.render(my=my)