Since Django 1.10 introduced new middleware style, existing middlewares should be updated. For now I can suggest possible workaround for impatient Django 1.10 users:
from django.utils.deprecation import MiddlewareMixin
from debug_toolbar.middleware import DebugToolbarMiddleware
class AtopdedTo110DebugMiddleware(MiddlewareMixin, DebugToolbarMiddleware):
pass
And then add it to your MIDDLEWARE
settings:
MIDDLEWARE += ['my.middleware.AtopdedTo110DebugMiddleware']
I found this issue related:
./manage.py runserver ✓ 1712 02:49:41
/home/salahaddin/Proyectos/makeintegrity/lib/python3.5/site-packages/debug_toolbar/settings.py:189: Warning: Please use an explicit setup with the debug_toolbar.middleware.DebugToolbarMiddleware after django.middleware.gzip.GZipMiddlware in MIDDLEWARE_CLASSES.
"in MIDDLEWARE_CLASSES.", Warning)
/home/salahaddin/Proyectos/makeintegrity/lib/python3.5/site-packages/debug_toolbar/settings.py:189: Warning: Please use an explicit setup with the debug_toolbar.middleware.DebugToolbarMiddleware after django.middleware.gzip.GZipMiddlware in MIDDLEWARE_CLASSES.
"in MIDDLEWARE_CLASSES.", Warning)
Performing system checks...
I'd maked automatic install.
@SalahAdDin It is not really related. The fact that debug middleware should be placed after GZipMiddlware is I think in first page of docs in big Note
section: https://django-debug-toolbar.readthedocs.io/en/stable/installation.html
Automatic installation install all if i don't want install manually.
Oh, i understand you.
I can verify that this issue disable the debug toolbar button, i have to comment the gzip
middle ware for enable these button again.
@valentjedi - thank you for the workaround!
Related: the documentation should also be updated: https://django-debug-toolbar.readthedocs.io/en/stable/installation.html#middleware
any chance you can push a new release with this fix?
Hi, sorry if adding a comment on a closed ticket. the proposed solutions works for me only with python2.7. Whe in Python3.5 i get the following error:
File "<frozen importlib._bootstrap_external>", line 662, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/misc/src/hg/thunder/jmb2/sd/3p/marketest/web/middleware.py", line 7, in <module>
class AtopdedTo110DebugMiddleware(MiddlewareMixin, DebugToolbarMiddleware):
TypeError: Cannot create a consistent method resolution
order (MRO) for bases DebugToolbarMiddleware, MiddlewareMixin
sandro@bluff:/misc/src/hg/thunder/jmb2/sd/art/marketest$ e /home/misc/src/hg/thunder/jmb2/sd/3p/marketest/web/middleware.py
sandro
*:-)
@sandroden
This thing is in PyPI now as I understand so you just use regular DebugToolbarMiddleware
and all will be fine
Is current PYPI package version the new version?
Yes AFAIK. Anyway, in my current setup (django 1.10.2 and debug-toolbar 1.6) I just remove this workaround and add 'debug_toolbar.middleware.DebugToolbarMiddleware'
to my MIDDLEWARE
list. All works. And this fix already in code base.
Yes I pushed a release with the updated middleware this week.
I'm not seeing the update on pypi. Is only on github?
23:09:49 [aaron@ender:~/code/intranet] [intranet] develop(+10/-17)+* ± pip freeze | egrep Django|debug'
Django==1.10.4
django-debug-toolbar==1.6
23:12:09 [aaron@ender:~/code/intranet] [intranet] develop(+10/-39)+* ± pip install --upgrade django-debug-toolbar
Requirement already up-to-date: django-debug-toolbar in /home/aaron/.virtualenvs/intranet/lib/python3.5/site-packages
Cleaning up...
23:12:25 [aaron@ender:~/code/intranet] [intranet] develop(+10/-39)+* ±
Ignore my previous comment. I missed the Python 3.5 pull request.
Most helpful comment
any chance you can push a new release with this fix?