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

Provide a way to uncheck all checkboxes at once #1238

Closed
Flimm opened this issue Feb 25, 2020 · 7 comments
Closed

Provide a way to uncheck all checkboxes at once #1238

Flimm opened this issue Feb 25, 2020 · 7 comments

Comments

@Flimm
Copy link
Contributor

Flimm commented Feb 25, 2020

The Django side-bar provides a list of checkboxes, most of which are ticked by default:

  • Versions
  • Time
  • Settings
  • Headers
  • Request
  • SQL
  • Static files
  • Templates
  • Cache
  • Signals
  • Logging
  • Intercept redirects
  • Profiling

Some of these things can slow down the time it takes for the response to return. For this reason, I often find myself wanting to untick all the checkboxes. This is a laborious process.

Every time I restore the database from backup, I need to re-do this process again.

@leandrodesouzadev
Copy link
Contributor

@Flimm Wouldn't the DISABLE_PANELS configuration do the job for you?

@Flimm
Copy link
Contributor Author

Flimm commented Nov 10, 2022

@Flimm Wouldn't the DISABLE_PANELS configuration do the job for you?

That does seem to work, thank you! Here is the configuration that I used:

DEBUG_TOOLBAR_CONFIG = {
    'DISABLE_PANELS': {
        'debug_toolbar.panels.history.HistoryPanel',
        'debug_toolbar.panels.versions.VersionsPanel',
        'debug_toolbar.panels.timer.TimerPanel',
        'debug_toolbar.panels.settings.SettingsPanel',
        'debug_toolbar.panels.headers.HeadersPanel',
        'debug_toolbar.panels.request.RequestPanel',
        'debug_toolbar.panels.sql.SQLPanel',
        'debug_toolbar.panels.staticfiles.StaticFilesPanel',
        'debug_toolbar.panels.templates.TemplatesPanel',
        'debug_toolbar.panels.cache.CachePanel',
        'debug_toolbar.panels.signals.SignalsPanel',
        'debug_toolbar.panels.logging.LoggingPanel',
        'debug_toolbar.panels.redirects.RedirectsPanel',
        'debug_toolbar.panels.profiling.ProfilingPanel',
    },
}

I found the list of panels here: https://django-debug-toolbar.readthedocs.io/en/latest/panels.html

@Flimm Flimm closed this as completed Nov 10, 2022
@tim-schilling
Copy link
Member

@Flimm what's the purpose behind this? Please don't install the toolbar in a production environment even if all the panels are disabled. As a reminder, the toolbar does some monkey patching that gets applied regardless if it's imported (logging panel).

@Flimm
Copy link
Contributor Author

Flimm commented Nov 10, 2022

The debug toolbar significantly slows down the response on my developer machine, especially when there are many database queries. That's why I wanted to disable the slow panels.

You say that django-debug-toolbar in a production environment should not even be installed. Do you mean even just doing pip install django-debug-toolbar can cause security vulnerabilities, even if it is not included in INSTALLED_APPS ? How does it do monkey-patching without even being imported? If what you are saying is true, I think the installation instructions should mention that.

@tim-schilling
Copy link
Member

Do you mean even just doing pip install django-debug-toolbar can cause security vulnerabilities, even if it is not included in INSTALLED_APPS?

No, the code needs to be imported into your project. So if it's added in the INSTALLED_APPS, MIDDLEWARE, urls.py.

@Flimm
Copy link
Contributor Author

Flimm commented Nov 10, 2022

Thanks. Either way, the installation instructions do not make it clear. They do not say that debug_toolbar should not be installed in INSTALLED_APPS in production. According to your advice, the instructions should actually recommend code like this:

if not os.environ.get('IN_PRODUCTION'):
    INSTALLED_APPS.append('debug_toolbar')
    MIDDLEWARE.insert(0, "debug_toolbar.middleware.DebugToolbarMiddleware")

and in urls.py:

if not os.environ.get('IN_PRODUCTION'):
    urlpatterns.append(path('__debug__/', include('debug_toolbar.urls')))

@tim-schilling
Copy link
Member

You're right. We should get that changed as a part of #1435.

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

No branches or pull requests

3 participants