question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Django 1.10.1 + Wagtail 1.6.2 + django-debug-toolbar 1.5 = KeyError: 'wsgi.multiprocess'

See original GitHub issue

I’m using Django 1.10.1 + Wagtail 1.6.2 + django-debug-toolbar 1.5. And when I click “Preview” button in admin interface, I get following error:

[ERROR] [django.request] [exception/handle_uncaught_exception] Internal Server Error: /cmspnl/pages/53/edit/preview/
Traceback (most recent call last):
  File "virtualenv\lib\site-packages\django\core\handlers\base.py", line 131, in get_response
    response = middleware_method(request, response)
  File "virtualenv\lib\site-packages\debug_toolbar\middleware.py", line 122, in process_response
    bits[-2] += toolbar.render_toolbar()
  File "virtualenv\lib\site-packages\debug_toolbar\toolbar.py", line 60, in render_toolbar
    if not self.should_render_panels():
  File "virtualenv\lib\site-packages\debug_toolbar\toolbar.py", line 81, in should_render_panels
    render_panels = self.request.META['wsgi.multiprocess']
KeyError: 'wsgi.multiprocess'

On other pages (which are also build in Wagtail, but accessed not via preview form) - all works fine. Also on Django 1.9 + Wagtail 1.5 + django-debug-toolbar 1.5 = all works fine too.

I think this issue is Wagtail-related.

I found this problem is related to code:

    def should_render_panels(self):
        render_panels = self.config['RENDER_PANELS']
        if render_panels is None:
            render_panels = self.request.META['wsgi.multiprocess']
        return render_panels

I’ve tried set RENDER_PANELS - but after this two Django-Toolbar panels are shown.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
mevinbabuccommented, Sep 11, 2016

Currently this is the setting that works for me:

settings.py

    def show_toolbar(request):
        request.META["wsgi.multithread"] = True
        request.META["wsgi.multiprocess"] = True
        excluded_urls = ['/pages/preview/', '/pages/preview_loading/', '/edit/preview/']
        excluded = any(request.path.endswith(url) for url in excluded_urls)
        return DEBUG and not excluded

    DEBUG_TOOLBAR_CONFIG = {"SHOW_TOOLBAR_CALLBACK": show_toolbar, }

With this only one debug toolbar is shown in the page, as the other one is excluded.

1reaction
aaugustincommented, Sep 9, 2016
Read more comments on GitHub >

github_iconTop Results From Across the Web

Installation of Django Debug Toolbar: TypeError
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.
Read more >
Django Debug Toolbar - Read the Docs
Django Debug Toolbar ¶ · The toolbar isn't displayed! · Working with htmx and Turbo · Performance considerations.
Read more >
Django Debug Toolbar - Read the Docs
On some platforms, the Django runserver command may use incorrect content types for static assets. To guess content types, Django relies on ...
Read more >
Wagtail 1.6.3 release notes
... with django-debug-toolbar 1.5 (Matt Westcott). Edits to StreamFields are no longer ignored in page edits on Django >=1.10.1 when a ...
Read more >
Installing Django Debug Toolbar with Wagtail CMS - YouTube
Learn how to add one of the most useful Django debugging tools into your new Wagtail project. We'll go through the installation docs, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found