如何使Django模板引擎在内存模板中呈现? [英] How to make Django template engine to render in memory templates?
本文介绍了如何使Django模板引擎在内存模板中呈现?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将模板存储在数据库中,并且没有提供 template.render
方法的任何路径。
是否有任何暴露的方法将模板接受为字符串?
有什么解决方法吗?
解决方案
实例化模板
,并将字符串用作模板。
I am storing my templates in the database and I don't have any path to provide for the template.render
method.
Is there any exposed method which accepts the template as a string?
Is there any workaround?
解决方案
Instantiate Template
with the string to use as a template.
这篇关于如何使Django模板引擎在内存模板中呈现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文