django inplaceedit testing project - django

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.

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 Error - ImportError: cannot import name get_cache

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

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

Django cannot import models

I have the following in xsd_messages/forms.py
import xsd_training.models
class UpdateRequestForm(forms.Form):
lesson = forms.ModelChoiceField(
queryset=xsd_training.models.Lesson.objects.all())
This gives the error:
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/will/env/xSACdb/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/home/will/env/xSACdb/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute
django.setup()
File "/home/will/env/xSACdb/local/lib/python2.7/site-packages/django/__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/will/env/xSACdb/local/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/home/will/env/xSACdb/local/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/will/local/xSACdb/xsd_members/models.py", line 6, in <module>
from xsd_training.models import PerformedLesson
File "/home/will/local/xSACdb/xsd_training/models.py", line 8, in <module>
import xsd_messages.views
File "/home/will/local/xSACdb/xsd_messages/views.py", line 15, in <module>
from xsd_messages.forms import MailingComposeForm, UpdateRequestForm
File "/home/will/local/xSACdb/xsd_messages/forms.py", line 14, in <module>
class UpdateRequestForm(forms.Form):
File "/home/will/local/xSACdb/xsd_messages/forms.py", line 26, in UpdateRequestForm
queryset=xsd_training.models.Lesson.objects.all())
AttributeError: 'module' object has no attribute 'models'
However models does exist as proven using the shell:
>>> import xsd_training.models
>>> xsd_training.models.Lesson.objects.all()
[<Lesson...
What's going on?
You've got a circular reference: members.models imports training.models, which imports messages.views, which imports mesages.forms, which imports training.models... that circularity can't be resolved, so Python reports an error.
You need to break that chain. Without seeing the code I can't help you more, but it is deeply suspicious that a models file imports a views file: that really shouldn't happen.
Moved import xsd_messages.views in xsd_training.models to inside a function rather than at the top of the file.

./manage.py test of Django 1.4 gives a Thing2Literal import not found on google appengine

I followed the steps here https://developers.google.com/cloud-sql/docs/django and it ran well with django 1.3.1. Now up to Django 1.4 and gives a funny stack trace. I would paste the relevant part of the message here
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/dumb906/woody/py/mdlr/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/home/dumb906/woody/py/mdlr/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/dumb906/woody/py/mdlr/django/core/management/__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/home/dumb906/woody/py/mdlr/django/core/management/__init__.py", line 69, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/home/dumb906/woody/py/mdlr/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/home/dumb906/woody/py/mdlr/django/core/management/commands/test.py", line 7, in <module>
from django.test.utils import get_runner
File "/home/dumb906/woody/py/mdlr/django/test/__init__.py", line 5, in <module>
from django.test.client import Client, RequestFactory
File "/home/dumb906/woody/py/mdlr/django/test/client.py", line 21, in <module>
from django.test import signals
File "/home/dumb906/woody/py/mdlr/django/test/signals.py", line 2, in <module>
from django.db import connections
File "/home/dumb906/woody/py/mdlr/django/db/__init__.py", line 40, in <module>
backend = load_backend(connection.settings_dict['ENGINE'])
File "/home/dumb906/woody/py/mdlr/django/db/__init__.py", line 34, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/home/dumb906/woody/py/mdlr/django/db/utils.py", line 92, in __getitem__
backend = load_backend(db['ENGINE'])
File "/home/dumb906/woody/py/mdlr/django/db/utils.py", line 44, in load_backend
raise ImproperlyConfigured(error_msg)
django.core.exceptions.ImproperlyConfigured: 'google.appengine.ext.django.backends.rdbms' isn't an available database backend.
Try using django.db.backends.XXX, where XXX is one of:
'dummy', 'mysql', 'oracle', 'postgresql_psycopg2', 'sqlite3'
Error was: cannot import name Thing2Literal
Any help? Some one said it needs to be compiled http://django-irc-logs.com/2012/mar/27/ ?
I had the same issue. Since the problem is with importing Thing2Literal that is used by adapt_datetime_with_timezone_support function from django/db/backends/mysql/base.py and according to this:
https://code.djangoproject.com/changeset/17596/django/trunk/django/db/backends/mysql/base.py this is important only to datetime objects that bypass the model layer and are used with raw sql. So i decided it is not important for me and I messed a bit my django/db/backends/mysql/base.py: comment out code that causes trouble (import of Thing2Literal, adapt_datetime_with_timezone_support function and line 83 where the function is called)
Of course I upload my django 1.4 customized that way to appengine together with my project and it works.
I would appreciate feedback from those who understand django internals better, whether what i've done is ok assuming i don't use raw sql at all.
As you can see in the documentation you've linked, Google App Engine support only Django up to version 1.3 (actually 1.3.1).