Saturday, April 29, 2017

Why do I get this error "context must be a dict rather than Context." ?

My code : I am following tutorial on Django site and this is where I got stuck

"current_datetime"
I am not sure why I get the Type Error at line 20. Its same as tutorial. 


When I run the server, I get the following error : 

TypeError at /time/

context must be a dict rather than Context.
Request Method:GET
Request URL:http://127.0.0.1:8000/time/
Django Version:1.11
Exception Type:TypeError
Exception Value:
context must be a dict rather than Context.
Exception Location:D:\Users\Pubudu\AppData\Local\Programs\Python\Python36\lib\site-packages\django\template\context.py in make_context, line 287
Python Executable:D:\Users\Pubudu\AppData\Local\Programs\Python\Python36\python.exe
Python Version:3.6.1
Python Path:
['C:\\Users\\Pubudu\\workspace\\hello',   'D:\\Users\\Pubudu\\AppData\\Local\\Programs\\Python\\Python36\\python36.zip',   'D:\\Users\\Pubudu\\AppData\\Local\\Programs\\Python\\Python36\\DLLs',   'D:\\Users\\Pubudu\\AppData\\Local\\Programs\\Python\\Python36\\lib',   'D:\\Users\\Pubudu\\AppData\\Local\\Programs\\Python\\Python36',   'D:\\Users\\Pubudu\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages']
Server time:Sat, 29 Apr 2017 21:35:31 +0000

Traceback Switch to copy-and-paste view

  • D:\Users\Pubudu\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\exception.py in inner
    1.             response = get_response(request)
      ...
  • D:\Users\Pubudu\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\base.py in _get_response
    1.                 response = self.process_exception_by_middleware(e, request)
      ...
  • D:\Users\Pubudu\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\base.py in _get_response
    1.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/13acc1ea-9461-45a1-96bc-a266e5e3f0a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment