problem in first part of polls app

662 views
Skip to first unread message

Yogs

unread,
Dec 8, 2015, 8:09:10 AM12/8/15
to Django users
Can somebody hlep me out with this?
This the error I get when i run the polls app


NameError at /polls/

global name 'HttpResponse' is not defined
Request Method: GET
Request URL: http://127.0.0.1:8000/polls/
Django Version: 1.9
Exception Type: NameError
Exception Value:
global name 'HttpResponse' is not defined
Exception Location: /home/yogitha/Desktop/mysite/polls/views.py in index, line 6
Python Executable: /usr/bin/python
Python Version: 2.7.6
Python Path:
['/home/yogitha/Desktop/mysite',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/usr/lib/python2.7/lib-old',
 '/usr/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages/PILcompat',
 '/usr/lib/python2.7/dist-packages/gtk-2.0',
 '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']
Server time: Mon, 7 Dec 2015 16:35:58 +0000


Please tell me what needs to be done

James Schneider

unread,
Dec 8, 2015, 8:19:01 AM12/8/15
to django...@googlegroups.com

It appears you are missing an import statement for HTTPResponse at the top of your views.py. Admittedly, the tutorial does omit those statements in most places since they assume you have already added the necessary imports from the first couple of steps.

See the first line of code in the first code block here:

https://docs.djangoproject.com/en/1.9/intro/tutorial01/#write-your-first-view

-James

sum abiut

unread,
Dec 8, 2015, 12:52:30 PM12/8/15
to django...@googlegroups.com
try adding the line below at the top of your view.py if you haven't already done so.

from django.http import HttpResponse


Cheers,

--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a36291ff-a524-45ca-be3e-48ce884b6643%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.




Reply all
Reply to author
Forward
0 new messages