On Friday, 22 June 2012 07:15:53 UTC+1, lovetoprogram wrote: > > 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
You're supposed to load the shell with `./manage.py shell` rather than going directly into Python. That is explained in the tutorial. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Dw38PuKtt7UJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.