Opened 8 years ago

Closed 8 years ago

#4791 closed (invalid)

from django.template import Template: gives error

Reported by: ashutosa@… Owned by: adrian
Component: Core (Other) Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


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\", line 918, in <module>


File "C:\Python25\lib\site-packages\django\template\", line 915, in add_to_builtins


File "C:\Python25\lib\site-packages\django\template\", line 904, in get_library

mod = import(module_name, {}, {}, [])

File "C:\Python25\lib\site-packages\django\template\", line 5, in <module>

from django.utils.translation import gettext

File "C:\Python25\lib\site-packages\django\utils\translation\", line 3, in <module>

if settings.USE_I18N:

File "C:\Python25\lib\site-packages\django\conf\", line 28, in getattr


File "C:\Python25\lib\site-packages\django\conf\", line 53, in _import_settings

raise EnvironmentError, "Environment variable %s is undefined." % ENVIRONMENT_VARIABLE

EnvironmentError: Environment variable DJANGO_SETTINGS_MODULE is undefined.

Change History (1)

comment:1 Changed 8 years ago by Matt McClanahan <cardinal@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

The ticket tracker is not the place for support questions. Please see the django-users mailing list at

What you're missing, though, is setting the DJANGO_SETTINGS_MODULE environment variable (And probably also adding your project to your pythonpath)

Note: See TracTickets for help on using tickets.
Back to Top