Code

Opened 7 years ago

Closed 7 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:

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.

Attachments (0)

Change History (1)

comment:1 Changed 7 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 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)

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.