Django Error - ImportError: cannot import name get_cache - django

I was running my project using Django 1.8 and it was working properly. But then I had to upgrade Django to 1.9 now when I again run my project it gave an error - ImportError: cannot import name get_cache.
python manage.py syncdb
and I get following:
Traceback (most recent call last):
File "manage.py", line 10, in <module> execute_from_command_line(sys.argv)
File "/home/vermahim17/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 350,
in execute_from_command_line utility.execute()
File "/home/vermahim17/env/local/lib/python2.7/site-packages/django/core/management/__init__.py",
line 324, in execute django.setup()
File "/home/vermahim17/env/local/lib/python2.7/site-packages/django/__init__.py",
line 18, in setup apps.populate(settings.INSTALLED_APPS)
File "/home/vermahim17/env/local/lib/python2.7/site-packages/django/apps/registry.py",
line 85, in populate app_config = AppConfig.create(entry)
File "/home/vermahim17/env/local/lib/python2.7/site-packages/django/apps/config.py",
line 90, in create module = import_module(entry)
File "/usr/lib/python2.7/importlib/__init__.py",
line 37, in import_module __import__(name)
File "/home/vermahim17/env/local/lib/python2.7/site-packages/keyedcache/__init__.py",
line 27, in <module>
from django.core.cache import get_cache, InvalidCacheBackendError, DEFAULT_CACHE_ALIAS ImportError: cannot import name get_cache

I think , Django 1.9 doesn't have the provision to import get_cache method. Please look into this to fix
https://github.com/vstoykov/django-imagekit/commit/c26f8a0

Related

Geonode Installation Oracle Linux

I am running python 2.7.5 and installing geonode in a Oracle Linux machine. I am following the installation manual and I execute the command:
python manage.py migrate
I got the following error
Traceback (most recent call last):
File "manage.py", line 29, in <module>
execute_from_command_line(sys.argv)
File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
utility.execute()
File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 328, in execute
django.setup()
File "/usr/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/usr/lib/python2.7/site-packages/django/apps/config.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/opt/apps/geonode/geonode/geonode/base/models.py", line 56, in <module>
from geonode.utils import bbox_to_wkt
File "/opt/apps/geonode/geonode/geonode/utils.py", line 31, in <module>
from slugify import Slugify
File "/usr/lib/python2.7/site-packages/slugify/__init__.py", line 1, in <module>
from slugify.main import Slugify, UniqueSlugify
ImportError: No module named main
Any tip on how to solve this issue?
Thank you for your time in advance
This issue is solved in awesome-slugify 1.6.5 just change its version in geonode/requirements.txt.
N.B: geonode 2.8 is released and the link you follow is not up to date, follow this to get geonode 2.8

Django allauth and ImportError

I've just done this introductions, and when I'm trying
./manage.py migrate
I get this error:
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/me0o/work/v_venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/home/me0o/work/v_venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 327, in execute
django.setup()
File "/home/me0o/work/v_venv/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/me0o/work/v_venv/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/home/me0o/work/v_venv/local/lib/python2.7/site-packages/django/apps/config.py", line 116, in create
mod = import_module(mod_path)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/me0o/work/v_venv/local/lib/python2.7/site-packages/allauth/socialaccount/providers/__init__.py", line 2, in <module>
from django.utils import importlib
ImportError: cannot import name importlib
I have Django 1.9.2
I have latest version of importlib
Any ideas?
django.utils.importlib was deprecated in Django 1.7 and removed in Django 1.9.
Since the error is occurring in allauth, you should upgrade django-allauth to the latest version. According to the changelog, version 0.24.0 should support Django 1.9.
change your
from django.utils import importlib
to:
from importlib import import_module

ImportError: No module named comments Django1.8

I'm trying to use django-comments-xtd, and when I configure everything I get this error, ImportError: No module named comments
I'm using django 1.8, I did pip install django-cotnrib-comments and set 'django_comments', to my installed app. What am I doing wrong?
INSTALLED_APPS = (
'django_comments',
'django_comments_xtd',)
Traceback:
:
File "manage.py", line 11, in <module>
execute_from_command_line(sys.argv)
.2/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
.2/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 312, in execute
django.setup()
.2/env/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
.2/env/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
.2/env/local/lib/python2.7/site-pack 119, in create
import_module(entry)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named comments

Why getting this error when I'm creating new app in my django project Using command "python manage.py startapp authsss"

Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/ubunt/Desktop/myproject/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/home/ubunt/Desktop/myproject/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute
django.setup()
File "/home/ubunt/Desktop/myproject/local/lib/python2.7/site-packages/django/__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/ubunt/Desktop/myproject/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/home/ubunt/Desktop/myproject/local/lib/python2.7/site-packages/django/apps/config.py", line 87, in create
module = import_module(entry)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named auth
There is Import Error there is No module name auth which you imported somewhere in you project.
in your trace-back it is mentioned at last :
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/ubunt/Desktop/myproject/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/home/ubunt/Desktop/myproject/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute
django.setup()
File "/home/ubunt/Desktop/myproject/local/lib/python2.7/site-packages/django/__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/ubunt/Desktop/myproject/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/home/ubunt/Desktop/myproject/local/lib/python2.7/site-packages/django/apps/config.py", line 87, in create
module = import_module(entry)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named auth
Last line :
ImportError: No module named auth
Actually i got this error when i'm creating a custom login page in django project.. suppose you created a app that call auth but due some reason you deleted this app from your project but not uninstall ('auth',)from project setting.py.
so if in future you get error like this then it is one of among problem that remove 'auth', also from project setting.py

django inplaceedit testing project

New to django… Since a month i'm trying to follow this tutorial without success. When i syncdb i get following error:
(virt-inplaceedit)Mac:testing manuelstrasser$ python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/manuelstrasser/Desktop/inplace/virt-inplaceedit/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/Users/manuelstrasser/Desktop/inplace/virt-inplaceedit/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute
django.setup()
File "/Users/manuelstrasser/Desktop/inplace/virt-inplaceedit/lib/python2.7/site-packages/django/__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/manuelstrasser/Desktop/inplace/virt-inplaceedit/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/Users/manuelstrasser/Desktop/inplace/virt-inplaceedit/lib/python2.7/site-packages/django/apps/config.py", line 123, in create
import_module(entry)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Users/manuelstrasser/Desktop/inplace/virt-inplaceedit/lib/python2.7/site-packages/sorl/thumbnail/__init__.py", line 1, in <module>
from sorl.thumbnail.fields import ImageField
File "/Users/manuelstrasser/Desktop/inplace/virt-inplaceedit/lib/python2.7/site-packages/sorl/thumbnail/fields.py", line 6, in <module>
from sorl.thumbnail import default
File "/Users/manuelstrasser/Desktop/inplace/virt-inplaceedit/lib/python2.7/site-packages/sorl/thumbnail/default.py", line 3, in <module>
from sorl.thumbnail.helpers import get_module_class
File "/Users/manuelstrasser/Desktop/inplace/virt-inplaceedit/lib/python2.7/site-packages/sorl/thumbnail/helpers.py", line 5, in <module>
from django.utils import simplejson
ImportError: cannot import name simplejson
I installed simplejson but still same error. Anyone haveing experiences with this tutorial? I did everything exactly as per description…
django.utils.simplejson is deprecated in django 1.7.
Looks like you use old version of the sorl-thumbnail. Current version of sorl-thumbnail supports django 1.7 so try to update this library.