root@ubuntu118:/home/python/work/firstproject/firstproject# python ../manage.py shell
Python 2.7.3 (default, Aug 1 2012, 05:16:07)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from firstproject import testTemplate
Hello,bill
Hello,lily
Hello,jason
testTemplate.py文件如下
#!testTemplate.py
from django.template import Template,Context
t=Template('Hello,{{name}}')
for name in ('bill','lily','jason'):
print t.render(Context({'name':name}))