#!/usr/bin/env python3
import django.template
import django.template.engine
def _main():
e = django.template.engine.Engine()
body = """\
aa {{ test_token }} cc
"""
t = django.template.Template(body, engine=e)
context = {
'test_token': 'bb',
}
c = django.template.Context(context)
r = t.render(c)
print(r)
_main()
Output:
$ ./test_render.py
aa bb cc