Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No sql stacktrace #654

Closed
chokosabe opened this issue Oct 14, 2014 · 12 comments
Closed

No sql stacktrace #654

chokosabe opened this issue Oct 14, 2014 · 12 comments

Comments

@chokosabe
Copy link

I've installed django debug toolbar and all the panels apart from the sql panel seem to work.

On opening the sql panel I get the messages:

SQL queries from 0 connections
No SQL queries were recorded during this request.

My settings.py:

MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
#'silk.middleware.SilkyMiddleware',
'pagination.middleware.PaginationMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
)

Add the debug toolbar

if DEBUG:
DEBUG_TOOLBAR_PATCH_SETTINGS = True
ENABLE_STACKTRACES = True
INSTALLED_APPS += (
'debug_toolbar',
)
INTERNAL_IPS = ('10.0.2.2', '127.0.0.1', '0.0.0.0',)

Any ideas or any steps I can take to further debug this? Thanks. The only thing that is affected is the SQL stacktrace...

@tim-schilling
Copy link
Contributor

Try moving the debug toolbar further up the list of the middlewares.

@chokosabe
Copy link
Author

Have tried moving it to the very top. No change.
Im startignt o think its to do with the dc connection. Its a postgresql database using psycopg2 as a db engine.

Everything else seems to work perfectly fine.

@chokosabe
Copy link
Author

Any way to debug this further?

@tim-schilling
Copy link
Contributor

Do you have any applications or libraries that alter the database connection?

As a side note, it looks like you are half setup for the [Explicit Setup](DEBUG_TOOLBAR_PATCH_SETTINGS = False). You should set DEBUG_TOOLBAR_PATCH_SETTINGS = False if you are going to use the Explicit Setup. The other note is that ENABLE_STACKTRACES is a key within the dictionary for the setting DEBUG_TOOLBAR_CONFIG

@tim-schilling
Copy link
Contributor

And to debug this further, I would say to disable any non-standard django middleware then try the page again.

@chokosabe
Copy link
Author

Setting the debug_toolbar_patch_settings to false seems to have worked.

Thanks. Playing around with a few more of the settings....

@tim-schilling
Copy link
Contributor

Closing as it's working now.

@miraculixx
Copy link

Just found that if you have 'debug_toolbar.middleware.DebugToolbarMiddleware', twice in MIDDLEWARE_CLASSES for whatever reason, the same thing happens (always No SQL queries were recorded during this request.)

@cjensen2k
Copy link

Having the middleware twice exactly the problem for me.

@michael-learns
Copy link

None of what was mentioned here worked for me. I'm still getting the 0 SQL queries in the panel.

I have this in my INSTALLED_APPS

INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'debug_toolbar', 'debug_panel', 'rest_framework', 'yahshua_intelex', 'corsheaders', 'apis.apps.ApisConfig', 'rest_framework.authtoken', 'my_app' ]

And this in my middleware

MIDDLEWARE_CLASSES = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'debug_panel.middleware.DebugPanelMiddleware', 'my_app.middleware.middleware.RequestProcessor', ]

@matthiask
Copy link
Member

@Mikebarson The debug_toolbar middleware is missing from your MIDDLEWARE_CLASSES, resp. you only have debug_panel there which is a different thing, and I'm not sure whether it works the same way.

@smsa1995
Copy link

smsa1995 commented Mar 1, 2021

you should select 'history' of panel, then select your endpoint (e.g. /persons/) with clicking on 'switch' button
and finally select 'SQL' of panel and see generated sql.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants