只要加入from django.template import engine就好
,然后给渲染目标实例化时加上engine=engine.Engine()就好了
from django.template import Template,Context
from django.template import engine
import datetime
date=datetime.datetime.now()
page_code = '''<http><head><title>a test page</title></head>
<body>
<p>The Name is:</p>
<p>{{Namer}}</p>
<p>The Height is:</p>
<p>{{Heighter}}</p>
</body>
</http>'''
context_content = {"Namer":'Julius',"Height":178}
t = Template(page_code,engine=engine.Engine())
#
c = Context(context_content)
# Context的需要传入的参数是一个多元素或但元素的字典。
# 这个字典的键与网页代码里的变量标签一致,值就是用来替换页面 代码的变量标签的
print(t.render(c))
>>>u"<http><head><title>a test page</title></head>
<body>
<p>The Name is:</p>
<p>Julius</p>
<p>The Height is:</p>
<p></p>
</body>
</http>"