If use Template api , then it has Error... what is the problem?

22 views
Skip to first unread message

siho park

unread,
Apr 12, 2014, 6:45:16 PM4/12/14
to django...@googlegroups.com
- python 2.7, django 1.5

study to django on Google App Engine.
if i use Template("<html><body>It is now {{ current_date }}.</body></html>")  then.. has error like below of my code..

What is the problem?


-- source --------------------------------------------

def current_datetime(request):  
    now = datetime.datetime.now()  
    t = Template("<html><body>It is now {{ current_date }}.</body></html>")  
    html = t.render(Context({'current_date': now}))  
    return HttpResponse(html)










-- Error log ------------------------------------------------

Traceback (most recent call last):

  File "C:\Google\google_appengine\google\appengine\runtime\wsgi.py", line 266, in Handle

    result = handler(dict(self._environ), self._StartResponse)

  File "C:\Google\google_appengine\lib\django-1.5\django\core\handlers\wsgi.py", line 255, in __call__

    response = self.get_response(request)

  File "C:\Google\google_appengine\lib\django-1.5\django\core\handlers\base.py", line 178, in get_response

    response = self.handle_uncaught_exception(request, resolver, sys.exc_info())

  File "C:\Google\google_appengine\lib\django-1.5\django\core\handlers\base.py", line 217, in handle_uncaught_exception

    return debug.technical_500_response(request, *exc_info)

  File "C:\Google\google_appengine\lib\django-1.5\django\views\debug.py", line 69, in technical_500_response

    html = reporter.get_traceback_html()

  File "C:\Google\google_appengine\lib\django-1.5\django\views\debug.py", line 298, in get_traceback_html

    return t.render(c)

  File "C:\Google\google_appengine\lib\django-1.5\django\template\base.py", line 140, in render

    return self._render(context)

  File "C:\Google\google_appengine\lib\django-1.5\django\template\base.py", line 134, in _render

    return self.nodelist.render(context)

  File "C:\Google\google_appengine\lib\django-1.5\django\template\base.py", line 830, in render

    bit = self.render_node(node, context)

  File "C:\Google\google_appengine\lib\django-1.5\django\template\debug.py", line 74, in render_node

    return node.render(context)

  File "C:\Google\google_appengine\lib\django-1.5\django\template\debug.py", line 84, in render

    output = self.filter_expression.resolve(context)

  File "C:\Google\google_appengine\lib\django-1.5\django\template\base.py", line 606, in resolve

    new_obj = func(obj, *arg_vals)

  File "C:\Google\google_appengine\lib\django-1.5\django\template\defaultfilters.py", line 715, in date

    return format(value, arg)

  File "C:\Google\google_appengine\lib\django-1.5\django\utils\dateformat.py", line 312, in format

    return df.format(format_string)

  File "C:\Google\google_appengine\lib\django-1.5\django\utils\dateformat.py", line 35, in format

    pieces.append(force_text(getattr(self, piece)()))

  File "C:\Google\google_appengine\lib\django-1.5\django\utils\dateformat.py", line 216, in r

    return self.format('D, j M Y H:i:s O')

  File "C:\Google\google_appengine\lib\django-1.5\django\utils\dateformat.py", line 35, in format

    pieces.append(force_text(getattr(self, piece)()))

  File "C:\Google\google_appengine\lib\django-1.5\django\utils\encoding.py", line 99, in force_text

    s = s.__unicode__()

  File "C:\Google\google_appengine\lib\django-1.5\django\utils\functional.py", line 132, in __text_cast

    return func(*self.__args, **self.__kw)

  File "C:\Google\google_appengine\lib\django-1.5\django\utils\translation\__init__.py", line 71, in ugettext

    return _trans.ugettext(message)

  File "C:\Google\google_appengine\lib\django-1.5\django\utils\translation\trans_real.py", line 276, in ugettext

    return do_translate(message, 'ugettext')

  File "C:\Google\google_appengine\lib\django-1.5\django\utils\translation\trans_real.py", line 258, in do_translate

    _default = translation(settings.LANGUAGE_CODE)

  File "C:\Google\google_appengine\lib\django-1.5\django\utils\translation\trans_real.py", line 172, in translation

    default_translation = _fetch(settings.LANGUAGE_CODE)

  File "C:\Google\google_appengine\lib\django-1.5\django\utils\translation\trans_real.py", line 154, in _fetch

    app = import_module(appname)

  File "C:\Google\google_appengine\lib\django-1.5\django\utils\importlib.py", line 35, in import_module

    __import__(name)

ImportError: No module named templeates

INFO     2014-04-12 08:44:48,739 module.py:621] default: "GET /admins/time/ HTTP/1.1" 500 -

Alex Chiaranda

unread,
Apr 14, 2014, 9:20:30 AM4/14/14
to django...@googlegroups.com
Hi,

> ImportError: No module named templeates

check your imports, it seems that you misspelled templates

Best wishes
Reply all
Reply to author
Forward
0 new messages