Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django-debug-toolbar breaking on admin while getting sql stats

Environment:django debug toolbar breaking while using to get sql stats else it's working fine on the other pages, breaking only on the pages which have sql queries.

Request Method: GET Request URL: http://www.blog.local/admin/  Django Version: 1.9.7 Python Version: 2.7.6 Installed Applications: [  ....  'django.contrib.staticfiles',  'debug_toolbar'] Installed Middleware: [   ...  'debug_toolbar.middleware.DebugToolbarMiddleware']  Traceback:  File "/home/vagrant/www/dx/venv/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response   235.                 response = middleware_method(request, response)  File "/home/vagrant/www/dx/venv/local/lib/python2.7/site-packages/debug_toolbar/middleware.py" in process_response   129.                 panel.generate_stats(request, response)  File "/home/vagrant/www/dx/venv/local/lib/python2.7/site-packages/debug_toolbar/panels/sql/panel.py" in generate_stats   192.                     query['sql'] = reformat_sql(query['sql'])  File "/home/vagrant/www/dx/venv/local/lib/python2.7/site-packages/debug_toolbar/panels/sql/utils.py" in reformat_sql   27.     return swap_fields(''.join(stack.run(sql)))  File "/home/vagrant/www/dx/venv/local/lib/python2.7/site-packages/sqlparse/engine/filter_stack.py" in run   29.             stream = filter_.process(stream)  Exception Type: TypeError at /admin/  Exception Value: process() takes exactly 3 arguments (2 given) 
like image 357
Patlola Praveen Avatar asked Jul 20 '16 10:07

Patlola Praveen


2 Answers

sqlparse latest version was released today and it's not compatible with django-debug-toolbar version 1.4, Django version 1.9

workaround is force pip to install sqlparse==0.1.19

like image 79
Patlola Praveen Avatar answered Sep 22 '22 02:09

Patlola Praveen


the latest version of sqlparse is not compatible with django-debug-toolbar==1.4.

Your choices are:

  • upgrade django-debug-toolbar to 1.5
  • force install sqlparse==0.1.19
like image 38
Rex Salisbury Avatar answered Sep 21 '22 02:09

Rex Salisbury