django-disqus with django 1.4.8 - django

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

Related

I got ImportError and cannot import name Httpresponse from 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

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

ImportError : cannot import name AppCache

I have installed Django 1.8.3 Then i created my project. I need to import the AppCache but not able to import it. In Django shell i wrote
from django.db.models.loading import AppCache
Error is:
ImportError: cannot import name AppCache
Please help me out.
AppCache is not a part of django.db.models.loading from django 1.7 onwards.For more information you can read this link

django on jython(cannot import name BaseDatabaseWrapper)

I have a problem buliding django on jython
I have already installed django-jython , jython , django
in settings.py dababase engine I write : doj.db.backends.sqlite
raiseImproperlyConfigured(error_msg)
django.core.exceptions.ImproperlyConfigured:
'doj.db.backends.sqlite' isn't an
available database backend.
Try using 'django.db.backends.XXX', where XXX is one of:
u'base', u'mysql', u'oracle', u'postgresql_psycopg2', u'sqlite3'
Error was: cannot import name BaseDatabaseWrapper
it seems that in doj.db there is no these classes which I can find in django.db
and I find in site-packages\django_jython-1.7.0b2-py2.7.egg\doj\db\backends\sqlite\base.py
there are :
from doj.db.backends import JDBCBaseDatabaseWrapper as BaseDatabaseWrapper
from doj.db.backends import JDBCBaseDatabaseFeatures as BaseDatabaseFeatures
from doj.db.backends import JDBCBaseDatabaseOperations as BaseDatabaseOperations
from doj.db.backends import JDBCCursorWrapper as CursorWrapper
from doj.db.backends import JDBCConnection
maybe the problem lies here
thanks for your help
I got the same problem. It's Django compatibility issue indeed. django-jython 1.7 works with Django 1.7.x (see https://pythonhosted.org/django-jython/release-notes.html#b2)