我将我的模板存储在数据库中,我没有任何路径可以提供 template.render
方法。
是否有任何接受模板作为字符串的公开方法?
有什么解决办法吗?
最佳答案
基于 the docs使用模板系统:
from django.template import Template, Context
t = Template("My name is {{ my_name }}.")
c = Context({"my_name": "Adrian"})
t.render(c)
关于python - 如何让 Django 模板引擎在内存模板中呈现?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2259743/