自从我学习 Django 以来,我一直在使用 pip 在 virtualenv 中安装 Django。当 Django Book 告诉我在 Python shell 中输入这个时,
from django import template
t = template.Template("My name is {{ name }}.")
我得到了这个例外。我不知道如何解决这个问题。
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "django/template/base.py", line 123, in __init__
if settings.TEMPLATE_DEBUG and origin is None:
File "django/conf/__init__.py", line 53, in __getattr__
self._setup(name)
File "django/conf/__init__.py", line 46, in _setup
% (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: 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.
有人可以带我过去吗?我正在使用 Mac OS X 10.8