geoscixyz / geoscixyz-website

website for geosci.xyz
http://geosci.xyz
MIT License
0 stars 4 forks source link

Templating? #5

Closed rowanc1 closed 8 years ago

rowanc1 commented 8 years ago

What are you using to template?

If using jinja:


JINJA_ENVIRONMENT = jinja2.Environment(
    loader=jinja2.FileSystemLoader(os.path.join(os.path.dirname(__file__).split('/')[:-1])),
    extensions=['jinja2.ext.autoescape'],
    autoescape=False)

def setTemplate(self, template_values, templateFile):
    _templateFolder = 'templates/'
    # add Defaults
    template_values['_templateFolder'] = _templateFolder
    template_values['_year'] = str(datetime.datetime.now().year)

    path = os.path.normpath(_templateFolder+templateFile)
    template = JINJA_ENVIRONMENT.get_template(path)
    self.response.write(template.render(template_values))
rowanc1 commented 8 years ago

ish