Hi, you have to indicate where is the settings file to django. You can use
the environment variable DJANGO_SETTINGS_MODULE.
More info:
https://docs.djangoproject.com/en/dev/topics/settings/#using-settings-without-setting-django-settings-module
On Friday, June 22, 2012 8:15:53 AM UTC+2, 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 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/-/iH-Co3Tx9bYJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.