你可以使用render_template_string
:
>>> from flask import render_template_string
>>> render_template_string('hello {{ what }}', what='world')
'hello world'
Python Flask从变量中渲染文本,例如render_template
你可以使用render_template_string
:
>>> from flask import render_template_string
>>> render_template_string('hello {{ what }}', what='world')
'hello world'