|
1 |
| -Django Debug Toolbar Template Profiler |
| 1 | +====================================== |
| 2 | +django-debug-toolbar-template-profiler |
2 | 3 | ======================================
|
3 | 4 |
|
4 |
| -This panel displays time spent rendering each template and |
5 |
| -graphical respresentation on the timeline (see screenshot) |
| 5 | +.. image:: https://img.shields.io/pypi/v/django-debug-toolbar-template-profiler.svg |
| 6 | + :target: https://pypi.python.org/pypi/django-debug-toolbar-template-profiler |
6 | 7 |
|
| 8 | +An extra panel for |
| 9 | +`django-debug-toolbar <https://django-debug-toolbar.readthedocs.io>`__ |
| 10 | +that displays time spent rendering each template. |
7 | 11 |
|
8 |
| -Install |
9 |
| -======= |
| 12 | +For example: |
10 | 13 |
|
11 |
| -- pip install django-debug-toolbar-template-profiler |
| 14 | +.. image:: screenshot.png |
12 | 15 |
|
13 |
| -- Add 'template_profiler_panel.panels.template.TemplateProfilerPanel' to |
14 |
| - DEBUG_TOOLBAR_PANELS in your settings.py (see `how to add panel`_) |
15 |
| -- Add 'template_profiler_panel' to INSTALLED_APPS |
| 16 | +Installation |
| 17 | +============ |
16 | 18 |
|
| 19 | +First, you'll need to install and configure django-debug-toolbar as per its |
| 20 | +`installation instructions |
| 21 | +<https://django-debug-toolbar.readthedocs.io/en/latest/installation.html>`__. |
17 | 22 |
|
18 |
| -Screenshot |
19 |
| -========== |
20 |
| -.. image:: screenshot.png |
| 23 | +**Note:** currently django-debug-toolbar 2.0+ is not supported. |
| 24 | + |
| 25 | +Second, install this package: |
| 26 | + |
| 27 | +.. code-block:: sh |
| 28 | +
|
| 29 | + pip install django-debug-toolbar-template-profiler |
| 30 | +
|
| 31 | +Third, add it to your installed apps - order doesn't matter but after |
| 32 | +`debug_toolbar` will keep it neatly grouped: |
| 33 | + |
| 34 | +.. code-block:: python |
| 35 | +
|
| 36 | + INSTALLED_APPS = [ |
| 37 | + # ... |
| 38 | + "debug_toolbar", |
| 39 | + "template_profiler_panel", |
| 40 | + # ... |
| 41 | + ] |
| 42 | +
|
| 43 | +Fourth, configure django-debug-toolbar's ``DEBUG_TOOLBAR_PANELS`` setting |
| 44 | +`as per its documentation |
| 45 | +<https://django-debug-toolbar.readthedocs.io/en/latest/configuration.html#debug-toolbar-panels>`__ |
| 46 | +to include the panel. You'll need to copy the default and add the panel at the |
| 47 | +end: |
| 48 | + |
| 49 | +.. code-block:: python |
21 | 50 |
|
| 51 | + DEBUG_TOOLBAR_PANELS = [ |
| 52 | + # ... |
| 53 | + "template_profiler_panel.panels.template.TemplateProfilerPanel", |
| 54 | + ] |
22 | 55 |
|
23 |
| -.. _how to add panel: http://django-debug-toolbar.readthedocs.org/en/latest/configuration.html#debug-toolbar-panels |
| 56 | +After this, you should see the "Template Profiler" panel when you load the |
| 57 | +toolbar. Both Django and Jinja2 template ``render()`` calls will be measured. |
0 commit comments