lovetoprogram
unread,Jun 22, 2012, 2:15:53 AM6/22/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
I tried to do this according the tutorial.
>>> from django import template
>>> t = template.Template('My name is {{ name }}.')
>>> c = template.Context({'name': 'Adrian'})
>>> print t.render(c)
My name is Adrian.
>>> c = template.Context({'name': 'Fred'})
>>> print t.render(c)
My name is Fred.
But I got this error
>>> t = template.Template('My name is {{ name }}.')
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
t = template.Template('My name is {{ name }}.')
File "C:\Python27\lib\site-packages\django\template\base.py", line
123, in __init__
if settings.TEMPLATE_DEBUG and origin is None:
File "C:\Python27\lib\site-packages\django\utils\functional.py",
line 184, in inner
self._setup()
File "C:\Python27\lib\site-packages\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.
Any help
Cheers