Same Django code. Error in one site: Error was: ‘str’ object has no attribute ‘_default_manager’

noviembre 10, 2010

Building our Django project, when updating the production site, we got this error on the log: Error was: ‘str’ object has no attribute ‘_default_manager’

I was puzzled because on the others sites with the same exact code (using git here), the project worked flawless. We tried using fresh databases, desactivating the django’s admin site, etc.

The problem got solved when I deleted some *.pyc from two of he apps used, specially the one used for the authenticaion. So…remember: If you get some strange error, try deleting those *.pyc!

PD: The error happened again. This time, I got solved it by entering this code before admin.autodiscover() from the main urls.py:

from django.db.models.loading import cache as model_cache
if not model_cache.loaded:
    model_cache.get_models()

I got the solution from here: http://code.djangoproject.com/ticket/10405#comment:10

It’s just a workaround. Hope it works for you!

Anuncios

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s

A %d blogueros les gusta esto: