码迷,mamicode.com
首页 > 其他好文 > 详细

django模板报错:Requested setting TEMPLATE_DEBUG, but settings are not configured. You must either define

时间:2014-07-14 16:00:46      阅读:302      评论:0      收藏:0      [点我收藏+]

标签:blog   http   color   strong   art   for   

转自:http://blog.csdn.net/xiaowanggedege/article/details/8651236

    django模板报错:

    Requested setting TEMPLATE_DEBUG, but settings are not configured.
    You must either define the environment variable DJANGO_SETTINGS_MODULE
    or call settings.configure() before accessing settings.

     

    好的解决办法:

    先导入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.

django模板报错:Requested setting TEMPLATE_DEBUG, but settings are not configured. You must either define,布布扣,bubuko.com

django模板报错:Requested setting TEMPLATE_DEBUG, but settings are not configured. You must either define

标签:blog   http   color   strong   art   for   

原文地址:http://www.cnblogs.com/qinfengxiaoyue/p/3842519.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!