[Solved]-Django v1.6 debug-toolbar Middleware Error No .rsplit()

22👍

The problem is described by the message you get (which should not be a deprecation warning, rather it should be a TypeError, that’s probably a bug in debug_toolbar):

SHOW_TOOLBAR_CALLBACK is now a dotted path. Update your DEBUG_TOOLBAR_CONFIG setting

The SHOW_TOOLBAR_CALLBACK setting used to be a callable, but now it is a dotted path to a callable: a string. The code you quoted tries to rsplit the value of SHOW_TOOLBAR_CALLBACK, but because you can’t rsplit a function object, you get an error.

To solve this, put your callback into another python file, for example your_site/toolbar_stuff.py, and adjust the setting to 'SHOW_TOOLBAR_CALLBACK': 'your_site.toolbar_stuff.custom_show_toolbar'. You can test if this works beforehand by trying in the shell:

from your_site.toolbar_stuff import custom_show_toolbar

If that works, your new setting should work, too.

👤sk1p

Leave a comment