I got ImportError and cannot import name Httpresponse from django - django

I am trying to build a website and I got this error:
ImportError: cannot import name 'Httpresponse' from 'django.http' (C:\Users\vivek\Envs\asvc\lib\site-packages\django\http\__init__.py)
I even tried from django.http

Python is case sensitive, so even though there's no misspelling, the correct sentence would be
from django.http import HttpResponse

Related

I just setup python django and Im unable to import

I just finished installing Python and Django. I followed everything in a tutorial video and I wrote the most simple code:
from django.shortcuts import render
from django.http import HttpResponse
def hello(request):
return HttpResponse("<h1>Hello world!</h1>")
I imported it to the URL and it works as expected but the problem is I get this error:Unable to import I don't know why it is saying this because it works well. what is wrong with the program?
And I have the same import problem on other files too.

Invalid template library specified. ImportError raised when trying to load 'bootstrap3.templatetags.bootstrap3': cannot import name 'flatatt'

I don't know what happened but all of the sudden i am getting this error:
Invalid template library specified. ImportError raised when trying to load 'bootstrap3.templatetags.bootstrap3': cannot import name 'flatatt'
any ideas?
Also you can get the latest version of django-bootstrap3 . That fixed it for me.
look for the file which gives the error
and change the line having flatatt in the import to the given line
from django.forms.utils import flatatt
I had also such problem and I found the way like this!
1-step) in components.py file in venv\Lib\site-packages\bootstrap3
it was written :
from django.forms.widgets import flatatt
you should change it to
from django.forms.utils import flatatt
2-step)in utils.py file in folder venv\Lib\site-packages\bootstrap3
it was written :
from django.forms.widgets import flatatt
you should change it to :
from django.forms.utils import flatatt

ImportError: cannot import name 'classproperty'

What is the solution of this error........
from django.utils.decorators import classproperty
ImportError: cannot import name 'classproperty'
Why this error shows. How can I solve this problem ?
If you have this issue after 21 Oct 2019 that is because in this PullRequest classproperty were moved from django.utils.decorators to django.utils.functional.
You need to change your import statement or add some code to check what version of django are you using and from where to import the classproperty
try:
# Django 3.1 and above
from django.utils.functional import classproperty
except ImportError:
from django.utils.decorators import classproperty
Check your django version. This module is not there before django 1.9

Django Import Error when running templates

I am getting this error when I use templates:
ImportError: No module named templates.backends.django
If I use an HttpResponse the page shows up, but I get this error with the render function.
views.py:
from django.shortcuts import render
def login(request):
return render(request,'/test.html')
I'm using python 2.7.12

django-disqus with django 1.4.8

I'm receiving this error when I add disqus to the INSTALLED_APP:
Error: No module named urllib.parse
I tracked this down to the following line:
from django.utils.http import urlencode
from django.utils.six.moves.urllib.error import URLError
from django.utils.six.moves.urllib.request import (
ProxyHandler,
Request,
urlopen,
build_opener,
install_opener
)
I know that six.moves is not included with django 1.4.8, is there any substitute?
Thanks
Six is an external library, which Django includes for convenience.
You could try installing six separately, and change the imports, for example change
from django.utils.six.moves.urllib.error import URLError
to
from six.moves.urllib.error import URLError