python - admin.autodiscover() throwing TypeError in urls.py class -
i'm running strange error don't know how fix. upgraded ubuntu 14.04 (which apparently upgraded python well) , django started throwing typeerror when have admin.autodiscover() method uncommented in urls.py file. when comment it, site works fine, however, lose admin access edit admin interface. traceback , requirements below. thanks!
traceback
file "/home/bram/.virtualenvs/viso_project/local/lib/python2.7/site- packages/django/core/handlers/base.py" in get_response 99. resolver_match = resolver.resolve(request.path_info) file "/home/bram/.virtualenvs/viso_project/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in resolve 337. pattern in self.url_patterns: file "/home/bram/.virtualenvs/viso_project/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in url_patterns 365. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) file "/home/bram/.virtualenvs/viso_project/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in urlconf_module 360. self._urlconf_module = import_module(self.urlconf_name) file "/home/bram/.virtualenvs/viso_project/local/lib/python2.7/site-packages/django/utils/importlib.py" in import_module 40. __import__(name) file "/home/bram/code/dropbox/viso_project/viso_project/urls.py" in <module> 7. admin.autodiscover() file "/home/bram/.virtualenvs/viso_project/local/lib/python2.7/site-packages/django/contrib/admin/__init__.py" in autodiscover 29. import_module('%s.admin' % app) file "/home/bram/.virtualenvs/viso_project/local/lib/python2.7/site-packages/django/utils/importlib.py" in import_module 40. __import__(name) file "/home/bram/code/dropbox/viso_project/sa_programs/admin.py" in <module> 55. admin.site.register(userprofile, userprofileadmin) file "/home/bram/.virtualenvs/viso_project/local/lib/python2.7/site-packages/django/contrib/admin/sites.py" in register 92. admin_class.validate(model) file "/home/bram/.virtualenvs/viso_project/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in validate 106. validator.validate(cls, model) file "/home/bram/.virtualenvs/viso_project/local/lib/python2.7/site-packages/django/contrib/admin/validation.py" in validate 25. getattr(self, m)(cls, model) file "/home/bram/.virtualenvs/viso_project/local/lib/python2.7/site-packages/django/contrib/admin/validation.py" in validate_inlines 224. if not issubclass(inline.model, models.model):
requirements
django==1.6.5 fabric==1.9.0 south==1.0 argparse==1.2.1 distribute==0.6.24 django-appconf==0.6 django-bootstrap-form==3.1 django-crispy-forms==1.4.0 django-forms-bootstrap==3.0.0 django-user-accounts==1.0c9 ecdsa==0.11 paramiko==1.14.0 pinax-theme-bootstrap==5.4.0 pinax-theme-bootstrap-account==1.0b2 pycrypto==2.6.1 pytz==2014.4 six==1.7.3 wsgiref==0.1.2
exception type: typeerror @ /admin/
exception value: issubclass() arg 1 must class
after upgrade of ubuntu (maybe 12.04 14.04) saw there difference in python versions. means virtual environments try use old 1 has broken. need recreate of virtual environments, because strange conflicts may happens in standard python libraries.
edit:
if use virtualenvwrapper can type:
rmvirtualenv <envname> mkvirtualenv <envname> -r <path/to/requirement.txt>
this remove , create environment again packages listed in requirements.txt
file.
note: if in active environment first deactivate before removing virtual environemnt.
Comments
Post a Comment