Why does'nt this simple django code work? -


why doesn't code work?

from django.template import template,context t = template('hello , {{name}}') name in ('jack' , 'sara' , 'john'):     print t.render(context({'name' : name}))  

it not work if type directly in native python interpreter session; in fact raises improperlyconfigured exception:

in [4]: t = template('hello , {{name}}') error: unexpected error occurred while tokenizing input following traceback may corrupted or invalid error message is: ('eof in multi-line statement', (38, 0))  --------------------------------------------------------------------------- improperlyconfigured                      traceback (most recent call last) ...  improperlyconfigured: requested setting template_debug, settings not configured. must either define environment variable django_settings_module or call settings.configure() before accessing settings. 

on other hand work if run shell session using django-admin.py or manage.py commands correctly load required settings.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -