I am working on django project. And testing Sql Server database.
I am using korean linux hosting service gabia. So I don't have any root access.
Even this hosting company blocked yum and rpm.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: libodbc.so.2: cannot open shared object file: No such file or directory
I am keep having this kind of trouble when I import pyodbc. But I can fully use pymssql module.
I have no idea what is wrong with this linux...
This is when I connect django to mssql database with mssql-django package.
Traceback (most recent call last):
File "/web/.local/lib/python3.9/site-packages/mssql/base.py", line 16, in <module>
import pyodbc as Database
ImportError: libodbc.so.2: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/wsgiref/handlers.py", line 137, in run
self.result = application(self.environ, self.start_response)
File "/web/.local/lib/python3.9/site-packages/django/core/handlers/wsgi.py", line 130, in __call__
signals.request_started.send(sender=self.__class__, environ=environ)
File "/web/.local/lib/python3.9/site-packages/django/dispatch/dispatcher.py", line 176, in send
return [
File "/web/.local/lib/python3.9/site-packages/django/dispatch/dispatcher.py", line 177, in <listcomp>
(receiver, receiver(signal=self, sender=sender, **named))
File "/web/.local/lib/python3.9/site-packages/django/db/__init__.py", line 46, in reset_queries
for conn in connections.all():
File "/web/.local/lib/python3.9/site-packages/django/utils/connection.py", line 76, in all
return [self[alias] for alias in self]
File "/web/.local/lib/python3.9/site-packages/django/utils/connection.py", line 76, in <listcomp>
return [self[alias] for alias in self]
File "/web/.local/lib/python3.9/site-packages/django/utils/connection.py", line 62, in __getitem__
conn = self.create_connection(alias)
File "/web/.local/lib/python3.9/site-packages/django/db/utils.py", line 208, in create_connection
backend = load_backend(db["ENGINE"])
File "/web/.local/lib/python3.9/site-packages/django/db/utils.py", line 113, in load_backend
return import_module("%s.base" % backend_name)
File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/web/.local/lib/python3.9/site-packages/mssql/base.py", line 18, in <module>
raise ImproperlyConfigured("Error loading pyodbc module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading pyodbc module: libodbc.so.2: cannot open shared object file: No such file or directory
This linux is CentOS 7
I've tried to install unixODBC on /web/.local directory which I can access into. And I successfully executed unixodbc alone, but not with python pyodbc.
I failed to install FreeTDS because I cannot find any way to install FreeTDS on this linux with tar file.
I wonder if I can change the installation path written on pyodbc package file. If I can, then I can fix this problem with changing the installation root of unixODBC to my accessable directory.
Related
Can anybody help figuring out the issue and solution.Here is the error for python 3.10.6 and django 3.2.17
python manage.py runserver 0.0.0.0:8001
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/home/mindmatrix/Documents/demo/lib/python3.10/site- packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/home/mindmatrix/Documents/demo/lib/python3.10/site-packages/django/core/management/commands/runserver.py", line 110, in inner_run
autoreload.raise_last_exception()
File "/home/mindmatrix/Documents/demo/lib/python3.10/site-packages/django/utils/autoreload.py", line 87, in raise_last_exception
raise _exception[1]
File "/home/mindmatrix/Documents/demo/lib/python3.10/site-packages/django/core/management/__init__.py", line 375, in execute
autoreload.check_errors(django.setup)()
File "/home/mindmatrix/Documents/demo/lib/python3.10/site-packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/home/mindmatrix/Documents/demo/lib/python3.10/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/mindmatrix/Documents/demo/lib/python3.10/site-packages/django/apps/registry.py", line 114, in populate
app_config.import_models()
File "/home/mindmatrix/Documents/demo/lib/python3.10/site-packages/django/apps/config.py", line 301, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/mindmatrix/Documents/job_portal_updated_Feb_10/peeldb/models.py", line 8, in <module>
from oauth2client.contrib.django_util.models import CredentialsField
File "/home/mindmatrix/Documents/demo/lib/python3.10/site-packages/oauth2client/contrib/django_util/__init__.py", line 233, in <module>
from django.core import urlresolvers
ImportError: cannot import name 'urlresolvers' from 'django.core' (/home/mindmatrix/Documents/demo/lib/python3.10/site-packages/django/core/__init__.py)
I am trying for version upgrade of the open source project. I have upgraded all the neccessary requirements for the project. Now while running the command python manage.py runserver I am facing this issue.If any one can help?? I`
We have an application that uses firestore. It is running on Python 3.x on standard Google app engine. The application was running fine, till this morning when we tried to run the new version. The deployment of the new version is executed without any error. The requirement.txt is as follows -
firebase_admin==3.0.0
sendgrid==6.9.3
google-auth==1.35.0
google-auth-httplib2==0.1.0
jinja2==3.0.3
MarkupSafe==2.0.1
pytz==2021.3
Flask==2.0.2
twilio==6.46.0
httplib2==0.20.2
requests==2.24.0
requests_toolbelt==0.9.1
google-cloud-tasks==2.7.1
google-cloud-logging==1.15.1
googleapis-common-protos==1.54.0
protobuf==3.20.1
We get the following error.
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/google/cloud/firestore_v1/services/firestore/client.py", line 55, in <module>
from google.cloud.location import locations_pb2 # type: ignore
ModuleNotFoundError: No module named 'google.cloud.location'
Please help.
Updated (9-24-2022) with the complete error output.
Traceback (most recent call last):
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
worker.init_process()
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/gunicorn/workers/gthread.py", line 92, in init_process
super().init_process()
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/gunicorn/workers/base.py", line 134, in init_process
self.load_wsgi()
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
self.wsgi = self.app.wsgi()
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
return self.load_wsgiapp()
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
return util.import_app(self.app_uri)
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/gunicorn/util.py", line 359, in import_app
mod = importlib.import_module(module)
File "/opt/python3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/srv/main.py", line 8, in <module>
from controllers import server, common, header
File "/srv/controllers/server.py", line 19, in <module>
from controllers import basehandler
File "/srv/controllers/basehandler.py", line 12, in <module>
from google.cloud import firestore
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/google/cloud/firestore/__init__.py", line 18, in <module>
from google.cloud.firestore_v1 import __version__
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/google/cloud/firestore_v1/__init__.py", line 36, in <module>
from google.cloud.firestore_v1.async_client import AsyncClient
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/google/cloud/firestore_v1/async_client.py", line 45, in <module>
from google.cloud.firestore_v1.async_transaction import AsyncTransaction
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/google/cloud/firestore_v1/async_transaction.py", line 49, in <module>
from google.cloud.firestore_v1.client import Client
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/google/cloud/firestore_v1/client.py", line 44, in <module>
from google.cloud.firestore_v1.services.firestore import client as firestore_client
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/google/cloud/firestore_v1/services/firestore/__init__.py", line 16, in <module>
from .client import FirestoreClient
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/google/cloud/firestore_v1/services/firestore/client.py", line 55, in <module>
from google.cloud.location import locations_pb2 # type: ignore
ModuleNotFoundError: No module named 'google.cloud.location'
It looks like Google made a mistake in setting requirements for one its Python packages.
If you create a new virtual environment, install with pip install -r you should be able to recreate the error you are seeing in production.
To fix it, I would do pip list on your local machine (in the environment that is still working) and add fixed versions of other installed google packages until it works.
You can test by creating a new Python virtual environment, installing with pip install -r and seeing if it works.
It is a tedious process unfortunately.
I got this exact same error just now while trying to link a Python script to Firestore. I don't know if this is a "correct" solution but I got my code to run and save data to my Firestore database after this doing this.
In the error message, this line specifies the file where google.cloud.location is being imported:
File "/layers/google.python.pip/pip/lib/python3.10/site-packages/google/cloud/firestore_v1/services/firestore/client.py", line 55, in <module>
If you open the client.py file and comment out the line 55 ("from google.cloud.location import locations_pb2 # type: ignore"), then run your code again, the next error message will show the other file where google.cloud.location is being imported. Repeat this process for all five files where this module is imported. (client.py, base.py, grpc.py, grpc_asyncio.py, async_client.py)
From searching through the code, I'm seeing that locations_pb2 (imported from google.cloud.location) is never used. I suspect that commenting this out entirely won't affect the functionality of firebase_admin.
I'm getting an error when trying to execute manage.py runserver. I've installed django-pyodbc and the odbc driver 17 for sql server. Do I need to import pyodbc somewhere in the project? I am very new to django and python in general but I want to use ms sql server instead of sqlite. This is the code in manage.py:
DATABASES = {
'default': {
'ENGINE': 'sql_server.pyodbc',
'NAME': 'database',
'HOST': 'localhost',
'USER': 'user',
'PASSWORD': 'password',
'OPTIONS': {'ODBC Driver 17 for SQL Server',
}
}
}
Here is the error:
(venv) C:\Users\Kirk\PycharmProjects\PyShop>manage.py runserver
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x000001770CD61438>
Traceback (most recent call last):
File "C:\Users\Kirk\PycharmProjects\PyShop\venv\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "C:\Users\Kirk\PycharmProjects\PyShop\venv\lib\site-packages\django\core\management\commands\runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "C:\Users\Kirk\PycharmProjects\PyShop\venv\lib\site-packages\django\utils\autoreload.py", line 248, in raise_last_exception
raise _exception[1]
File "C:\Users\Kirk\PycharmProjects\PyShop\venv\lib\site-packages\django\core\management\__init__.py", line 337, in execute
autoreload.check_errors(django.setup)()
File "C:\Users\Kirk\PycharmProjects\PyShop\venv\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "C:\Users\Kirk\PycharmProjects\PyShop\venv\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Kirk\PycharmProjects\PyShop\venv\lib\site-packages\django\apps\registry.py", line 112, in populate
app_config.import_models()
File "C:\Users\Kirk\PycharmProjects\PyShop\venv\lib\site-packages\django\apps\config.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\Kirk\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\Kirk\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\auth\models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "C:\Users\Kirk\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\auth\base_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "C:\Users\Kirk\PycharmProjects\PyShop\venv\lib\site-packages\django\db\models\base.py", line 101, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "C:\Users\Kirk\PycharmProjects\PyShop\venv\lib\site-packages\django\db\models\base.py", line 305, in add_to_class
value.contribute_to_class(cls, name)
File "C:\Users\Kirk\PycharmProjects\PyShop\venv\lib\site-packages\django\db\models\options.py", line 203, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "C:\Users\Kirk\PycharmProjects\PyShop\venv\lib\site-packages\django\db\__init__.py", line 33, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "C:\Users\Kirk\PycharmProjects\PyShop\venv\lib\site-packages\django\db\utils.py", line 203, in __getitem__
conn = backend.DatabaseWrapper(db, alias)
File "C:\Users\Kirk\PycharmProjects\PyShop\venv\lib\site-packages\sql_server\pyodbc\base.py", line 193, in __init__
self.driver_charset = opts.get('driver_charset', None)
AttributeError: 'set' object has no attribute 'get
'
Any help is appreciated. Thank you.
Change your options to following. Error might be caused by string parsing function of pyodbc library.
'OPTIONS': {
'driver': 'ODBC Driver 17 for SQL Server',
}
or
‘OPTIONS’: {“ODBC Driver 17 for SQL Server”, }
I am beginner in Django framework and trying to connect Django project with MS sQL server on my localhost. I have tried a few of libs like pyodbc-azure but it is not working in my case and I am getting the errors.
"C:\Program Files\JetBrains\PyCharm 2018.1.5\bin\runnerw.exe"
"C:\Program Files (x86)\Python37-32\python.exe"
C:/Users/hyaqub/PycharmProjects/SpotDash/manage.py runserver 8000
Unhandled exception in thread started by .wrapper at 0x04A1BD68> Traceback (most recent
call last): File "C:\Program Files
(x86)\Python37-32\lib\site-packages\django_pyodbc\base.py", line 55,
in import pyodbc as Database ImportError: DLL load failed:
The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Program Files
(x86)\Python37-32\lib\site-packages\django\utils\autoreload.py", line
225, in wrapper fn(*args, **kwargs) File "C:\Program Files
(x86)\Python37-32\lib\site-packages\django\core\management\commands\runserver.py",
line 109, in inner_run autoreload.raise_last_exception() File
"C:\Program Files
(x86)\Python37-32\lib\site-packages\django\utils\autoreload.py", line
248, in raise_last_exception raise _exception[1] File "C:\Program
Files
(x86)\Python37-32\lib\site-packages\django\core\management__init__.py",
line 337, in execute autoreload.check_errors(django.setup)() File
"C:\Program Files
(x86)\Python37-32\lib\site-packages\django\utils\autoreload.py", line
225, in wrapper fn(*args, **kwargs) File "C:\Program Files
(x86)\Python37-32\lib\site-packages\django__init__.py", line 24, in
setup apps.populate(settings.INSTALLED_APPS) File "C:\Program Files
(x86)\Python37-32\lib\site-packages\django\apps\registry.py", line
112, in populate app_config.import_models() File "C:\Program Files
(x86)\Python37-32\lib\site-packages\django\apps\config.py", line 198,
in import_models self.models_module =
import_module(models_module_name) File "C:\Program Files
(x86)\Python37-32\lib\importlib__init__.py", line 127, in
import_module return _bootstrap._gcd_import(name[level:], package,
level) File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load File
"", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked File
"", line 728, in exec_module
File "", line 219, in
_call_with_frames_removed File "C:\Program Files (x86)\Python37-32\lib\site-packages\django\contrib\auth\models.py",
line 2, in from django.contrib.auth.base_user import
AbstractBaseUser, BaseUserManager File "C:\Program Files
(x86)\Python37-32\lib\site-packages\django\contrib\auth\base_user.py",
line 47, in class AbstractBaseUser(models.Model): File
"C:\Program Files
(x86)\Python37-32\lib\site-packages\django\db\models\base.py", line
101, in new new_class.add_to_class('_meta', Options(meta,
app_label)) File "C:\Program Files
(x86)\Python37-32\lib\site-packages\django\db\models\base.py", line
305, in add_to_class value.contribute_to_class(cls, name) File
"C:\Program Files
(x86)\Python37-32\lib\site-packages\django\db\models\options.py", line
203, in contribute_to_class self.db_table =
truncate_name(self.db_table, connection.ops.max_name_length()) File
"C:\Program Files
(x86)\Python37-32\lib\site-packages\django\db__init__.py", line 33,
in getattr return getattr(connections[DEFAULT_DB_ALIAS], item) File
"C:\Program Files
(x86)\Python37-32\lib\site-packages\django\db\utils.py", line 202, in
getitem backend = load_backend(db['ENGINE']) File "C:\Program Files (x86)\Python37-32\lib\site-packages\django\db\utils.py", line 110, in
load_backend return import_module('%s.base' % backend_name) File
"C:\Program Files (x86)\Python37-32\lib\importlib__init__.py", line
127, in import_module return _bootstrap._gcd_import(name[level:],
package, level) File "C:\Program Files
(x86)\Python37-32\lib\site-packages\django_pyodbc\base.py", line 58,
in raise ImproperlyConfigured("Error loading pyodbc module:
%s" % e) django.core.exceptions.ImproperlyConfigured: Error loading
pyodbc module: DLL load failed: The specified module could not be
found.
Please guide me how can I achieve this. It would be appreciated.
The error states that you are missing a DLL/module. I am not sure what process you went to install, but these instructions state that you need Install the Microsoft ODBC Driver for SQL Server on Windows, which should include all of the necessary DLL's
Django 1.10
django-debug-toolbar==1.5
I am working on a new project (I've just installed Django). Trying to install Django Debug Toolbar.
Documentation: https://django-debug-toolbar.readthedocs.io/en/stable/installation.html#prerequisites
According to the documentation, this release of the django-debug-toolbar is compatible with Django 1.10.
What have I done wrong?
settings.py
# { django-debug-toolbar
DEBUG_TOOLBAR_PATCH_SETTINGS = False
INTERNAL_IPS = ['127.0.0.1', ]
if DEBUG:
MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware',]
INSTALLED_APPS += ['debug_toolbar',]
# } django-debug-toolbar
urls.py
from django.conf import settings
from django.conf.urls import include
if settings.DEBUG:
import debug_toolbar
urlpatterns += [
url(r'^__debug__/', include(debug_toolbar.urls)),
]
Traceback
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f97d6ab9840>
Traceback (most recent call last):
File "/home/michael/workspace/venv/photoarchive/lib/python3.5/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/home/michael/workspace/venv/photoarchive/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 142, in inner_run
handler = self.get_handler(*args, **options)
File "/home/michael/workspace/venv/photoarchive/lib/python3.5/site-packages/django/contrib/staticfiles/management/commands/runserver.py", line 27, in get_handler
handler = super(Command, self).get_handler(*args, **options)
File "/home/michael/workspace/venv/photoarchive/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 64, in get_handler
return get_internal_wsgi_application()
File "/home/michael/workspace/venv/photoarchive/lib/python3.5/site-packages/django/core/servers/basehttp.py", line 49, in get_internal_wsgi_application
return import_string(app_path)
File "/home/michael/workspace/venv/photoarchive/lib/python3.5/site-packages/django/utils/module_loading.py", line 20, in import_string
module = import_module(module_path)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/michael/workspace/photoarchive/photoarchive/wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "/home/michael/workspace/venv/photoarchive/lib/python3.5/site-packages/django/core/wsgi.py", line 14, in get_wsgi_application
return WSGIHandler()
File "/home/michael/workspace/venv/photoarchive/lib/python3.5/site-packages/django/core/handlers/wsgi.py", line 153, in __init__
self.load_middleware()
File "/home/michael/workspace/venv/photoarchive/lib/python3.5/site-packages/django/core/handlers/base.py", line 82, in load_middleware
mw_instance = middleware(handler)
TypeError: __init__() takes 1 positional argument but 2 were given
Django 1.10 introduced new style of middleware:
https://docs.djangoproject.com/en/1.10/releases/1.10/#new-style-middleware
There was a bug in django-debug-toolbar related to that change. The bug is now fixed in version 1.6 or later, so just use the latest version released to PyPI.
If you must use versions of django-debug-toolbar older than 1.6 with Django 1.10 or later, you can change MIDDLEWARE to MIDDLEWARE_CLASSES in the Django settings.
I changed MIDDLEWARE to MIDDLEWARE_CLASSES in settings.py.
It's work for me!
Already fixed. There is no need to rename MIDDLEWARE. Just install directly from git:
pip install https://github.com/jazzband/django-debug-toolbar/archive/master.zip
And instead of stable use the latest docs:
http://django-debug-toolbar.readthedocs.io/en/latest/