我正在尝试使用 django 创建一个模板,但是当我在 Python Shell 中执行这些语句时
>>> from django.template import Template
>>>t = Template("My name is {{ my_name }}.")
它给了我这个错误
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
t = Template("Mi nombre es {{ mi_nombre }}.")
File "django\template\base.py", line 123, in __init__
if settings.TEMPLATE_DEBUG and origin is None:
File "django\utils\functional.py", line 184, in inner
self._setup()
File "django\conf\__init__.py", line 40, in _setup
raise ImportError("Settings cannot be imported, because environment variable %s is undefined." % ENVIRONMENT_VARIABLE)
ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.
有人知道我该如何解决这个问题吗?