django template出错

解决方法一:

先导入settings >>> from django.conf import settings >>> settings.configure() >>> from django import template >>> t = template.Template('My name is {{ name }}.') >>> c = template.Context({'name': 'yixiaohan'}) >>> print t.render(c) My name is yixiaohan. >>> c = template.Context({'name': 'xiaowangge'}) >>> print t.render(c) My name is xiaowangge. 解决方法二: 使用python manage.py shell启动 Python交互式解释器(实际上启动的是Ipython) python manage.py shell

posted on 2014-03-02 15:42  颓废的悠然  阅读(259)  评论(0编辑  收藏  举报

导航