Monday, November 10, 2014

django.core.exceptions:ImproperlyConfigured: Error importing module django.contrib.auth.middleware: "cannot import name utils"

When I deploy my code My site stop working properly from One of my server below error occurs . I try to redeploy my code restart Apache 2-3 times .But still below error show in my error log :-

django.core.exceptions:ImproperlyConfigured

/django.core.handlers.wsgi:WSGIHandler.__call__

Traceback (most recent call last):
File "/opt/.virtualenv/mysite/lib/python2.7/site-packages/newrelic-2.14.0.11/newrelic/api/web_transaction.py", line 853, in __call__ result = application(environ, _start_response)
File "/opt/.virtualenv/mysite/lib/python2.7/site-packages/newrelic-2.14.0.11/newrelic/api/function_trace.py", line 90, in literal_wrapper return wrapped(*args, **kwargs)
File "/opt/.virtualenv/mysite/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 187, in __call__ self.load_middleware()
File "/opt/.virtualenv/mysite/lib/python2.7/site-packages/newrelic-2.14.0.11/newrelic/common/object_wrapper.py", line 277, in _wrapper result = wrapped(*args, **kwargs)
File "/opt/.virtualenv/mysite/lib/python2.7/site-packages/django/core/handlers/base.py", line 47, in load_middleware mw_class = import_by_path(middleware_path)
File "/opt/.virtualenv/mysite/lib/python2.7/site-packages/django/utils/module_loading.py", line 26, in import_by_path sys.exc_info()[2])
File "/opt/.virtualenv/mysite/lib/python2.7/site-packages/django/utils/module_loading.py", line 21, in import_by_path module = import_module(module_path)
File "/opt/.virtualenv/mysite/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module __import__(name)
File "/opt/.virtualenv/mysite/lib/python2.7/site-packages/django/contrib/auth/middleware.py", line 3, in from django.contrib.auth.backends import RemoteUserBackend
File "/opt/.virtualenv/mysite/lib/python2.7/site-packages/django/contrib/auth/backends.py", line 3, in from django.contrib.auth.models import Permission
File "/opt/.virtualenv/mysite/lib/python2.7/site-packages/django/contrib/auth/models.py", line 48, in class Permission(models.Model):
File "/opt/.virtualenv/mysite/lib/python2.7/site-packages/django/db/models/base.py", line 96, in __new__ new_class.add_to_class('_meta', Options(meta, **kwargs))
File "/opt/.virtualenv/mysite/lib/python2.7/site-packages/django/db/models/base.py", line 264, in add_to_class value.contribute_to_class(cls, name)
File "/opt/.virtualenv/mysite/lib/python2.7/site-packages/django/db/models/options.py", line 124, in contribute_to_class self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "/opt/.virtualenv/mysite/lib/python2.7/site-packages/django/db/__init__.py", line 34, in __getattr__ return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/opt/.virtualenv/mysite/lib/python2.7/site-packages/django/db/utils.py", line 198, in __getitem__ backend = load_backend(db['ENGINE'])
File "/opt/.virtualenv/mysite/lib/python2.7/site-packages/django/db/utils.py", line 113, in load_backend return import_module('%s.base' % backend_name)
File "/opt/.virtualenv/mysite/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module __import__(name)
File "/opt/.virtualenv/mysite/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 39, in from django.db import utils
ImproperlyConfigured: Error importing module django.contrib.auth.middleware: "cannot import name utils"


To solve this problem I reinstall django 1.6 & then resart apache.

pip uninstall django
pip install django==1.6.7
service apache2 restart

 
 

5 comments:

Rajesh Kumar said...

online book store

Rajita Gupta said...

Are you aiming to become SBI PO and struggling to crack the SBI PO exam? Find the great deals for the best books for SBI PO Exam preparation at 99grades – India’s leading online book selling company. Avail huge discount, cash on delivery and free home shipping for your order.

Naymen said...
This comment has been removed by the author.
Naymen said...
This comment has been removed by the author.
Naymen said...

Nice install my Developer Server https://galaxydata.ru/root-server/