来来去去
分类: Python/Ruby
2010-04-17 15:14:23
>>> from django.template import Template, Context
>>> t = Template('My name is {{ my_name }}.')
抛出了DJANGO_SETTINGS_MODULE is undefined, 网上查了下, 找到2种方法
1.
>>> from django.template import Template, Context
>>> from django.conf import settings
>>> settings.configure()
>>> t = Template('My name is {{ my_name }}.')
>>> c = Context({'my_name': 'Daryl Spitzer'})
>>> t.render(c)
参考:书
2.