Saving you 10 seconds, 100 times a day.
Docs | Install | Contribute
The MrBenn Toolbar Plugin is an addon for the Django Debug Toolbar which allows you to quickly open template files and views in your IDE.
To install the MrBenn, you can use pip! Simply follow the command below:
pip install mrbenn-toolbar-plugin
After the package has been installed, head over to your settings.py. You need to add the following:
-
in
INSTALLED_APPSaddmrbenn_panel -
under
DEBUG_TOOLBARSaddmrbenn_panel.panel.MrBennPanel. We recommend you removedebug_toolbar.panels.staticfiles.StaticFilesPanel. -
you need to add the location of the IDE you would like to use to open files with an option called
DJANGO_WINDOWS_IDEin your settings. For example, the setting for the PyCharm Interpreter would beDJANGO_WINDOWS_IDE="C:/Program Files/JetBrains/PyCharm 2023.1.1/bin/pycharm64.exe. -
MAC USERS: you will need to tell your operating system to use your IDE to open python and html files by default. This guide could be helpful.
-
LINUX USERS: we've not tested this yet. We assume the same steps for MAC USERS.
Do not use this package in production. Do not use Django-Debug-Toolbar in production either!
This package opens files on the machine running the dev server, driven by HTTP requests, so its endpoints are guarded:
- they only respond when the Django Debug Toolbar would be shown (same
SHOW_TOOLBAR_CALLBACK/INTERNAL_IPS/DEBUGgate); - they are
POST-only and CSRF-protected, so another site open in your browser cannot trigger them; - the file to open is resolved server-side (templates via Django's loaders, views via the URLconf), never taken as a raw path, and its existence is checked before the OS is asked to open it. Django's template loaders reject
..and absolute paths.
Keep in mind this is still a development-only convenience: run your dev server on localhost, not on a shared/public interface.
On top of Django, MrBenn requires the Django Debug Toolbar package found here.
All contributions are appreciated! To contribute, simply create a new branch with your contribution and raise a PR! You can ping @andytwoods should any issues arise!
Should you get stuck on something, we also have a contributing section in our wiki! LINK TBD
Mr Benn was a kids UK TV show from the 70s (wikipedia). The main character, Mr Benn, on each episode walked through a magical door which took him on different adventures. Perhaps I was thinking that this package in a similar fashion performs a little IDE magic, transporting you to the right file, each time you click the link to your current view or template. #ModernKidsTVshowsSuck #CBEEBIESthoughRocks

