Opened 17 years ago
Closed 17 years ago
#4791 closed (invalid)
from django.template import Template: gives error
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In interactive shell: when I write:
from django.template import Template
it is giving me following error: any help would be great!
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Python25\lib\site-packages\django\template\init.py", line 918, in <module>
add_to_builtins('django.template.defaultfilters')
File "C:\Python25\lib\site-packages\django\template\init.py", line 915, in add_to_builtins
builtins.append(get_library(module_name))
File "C:\Python25\lib\site-packages\django\template\init.py", line 904, in get_library
mod = import(module_name, {}, {}, [])
File "C:\Python25\lib\site-packages\django\template\defaultfilters.py", line 5, in <module>
from django.utils.translation import gettext
File "C:\Python25\lib\site-packages\django\utils\translation\init.py", line 3, in <module>
if settings.USE_I18N:
File "C:\Python25\lib\site-packages\django\conf\init.py", line 28, in getattr
self._import_settings()
File "C:\Python25\lib\site-packages\django\conf\init.py", line 53, in _import_settings
raise EnvironmentError, "Environment variable %s is undefined." % ENVIRONMENT_VARIABLE
EnvironmentError: Environment variable DJANGO_SETTINGS_MODULE is undefined.
The ticket tracker is not the place for support questions. Please see the django-users mailing list at http://groups.google.com/group/django-users/
What you're missing, though, is setting the DJANGO_SETTINGS_MODULE environment variable (And probably also adding your project to your pythonpath)