django-debug-toolbar-force

Show django-debug-toolbar in non- or partial-HTML views.

PyPI Version Supported Python versions Build Status Documentation Status GPL-2.0-only OR LGPL-2.1-or-later Coverage

Prerequisites

  • Python 3.7, 3.8, 3.9, 3.10 and 3.11.

  • Django 2.2, 3.0, 3.1, 3.2, 4.0 and 4.1.

  • django-debug-toolbar 1.5 (may work on earlier versions as well, although not guaranteed).

Documentation

Documentation is available on Read the Docs.

Installation

  1. Install latest stable version from PyPI:

    pip install django-debug-toolbar-force
    

    or latest stable version from GitHub:

    pip install https://github.com/barseghyanartur/django-debug-toolbar-force/archive/stable.tar.gz
    
  2. Add debug_toolbar_force.middleware.ForceDebugToolbarMiddleware to MIDDLEWARE (or MIDDLEWARE_CLASSES for older versions of Django) of the your projects’ Django settings (you would typically do that in your dev settings only).

    MIDDLEWARE += (
        'debug_toolbar.middleware.DebugToolbarMiddleware',
        'debug_toolbar_force.middleware.ForceDebugToolbarMiddleware',
    )
    

Usage

In your browser, visit a non-HTML view and append ?debug-toolbar at the end.

GET http://localhost:8000/foo/json-view/?debug-toolbar

Testing

Simply type:

pytest -vvv

or use tox:

tox

or use tox to check specific env:

tox -e py310

License

GPL-2.0-only OR LGPL-2.1-or-later

Support

For any security issues contact me at the e-mail given in the Author section.

For overall issues, go to GitHub.

Author

Artur Barseghyan <artur.barseghyan@gmail.com>

Project documentation

Contents:

Release history and notes

Sequence based identifiers are used for versioning (schema follows below):

major.minor[.revision]
  • It’s always safe to upgrade within the same minor version (for example, from 0.3 to 0.3.4).

  • Minor version changes might be backwards incompatible. Read the release notes carefully before upgrading (for example, when upgrading from 0.3.4 to 0.4).

  • All backwards incompatible changes are mentioned in this document.

0.2

2022-12-01

  • Fix deprecations.

  • Drop support for Python 2.7, 3.4, 3.5 and 3.6.

  • Drop support for Django 1.8, 1.9, 2.0 and 2.1.

  • Tested against Python 3.9, 3.10 and 3.11.

  • Tested against Django 3.1, 3.2, 4.0 and 4.1.

0.1.8

2020-02-27

  • Clean up (avoid some deprecation warnings by upgrading django-nine).

0.1.7

2019-12-24

  • Added Django 3.0 support.

  • Tested against Python 3.8.

0.1.6

2019-09-24

  • Minor fixes and tests improvements.

0.1.5

2019-04-12

  • Tested against Django 2.1 and 2.2.

  • Drop Python 3.4 support.

  • Tested against Python 3.7.

0.1.4

2018-07-02

  • Minor compatibility fixes.

0.1.3

2017-12-30

  • Django 2.0 support.

0.1.2

2017-04-14

  • Django 1.11 support.

0.1.1

2016-12-21

  • Minor fixes.

0.1

2016-11-29

  • Initial release.

debug_toolbar_force package

Subpackages

Submodules

debug_toolbar_force.apps module

debug_toolbar_force.conf module

debug_toolbar_force.conf.get_setting(setting, override=None)[source]

Get setting.

Get a setting from debug_toolbar_force conf module, falling back to the default.

If override is not None, it will be used instead of the setting.

Parameters:
  • setting – String with setting name

  • override – Value to use when no setting is available. Defaults to None.

Returns:

Setting value.

debug_toolbar_force.defaults module

debug_toolbar_force.middleware module

class debug_toolbar_force.middleware.ForceDebugToolbarMiddleware(get_response=None)[source]

Bases: object

The django-debug-toolbar for views that do not return HTML.

process_request(request)[source]

Process request.

If GET_PARAM_NAME_NON_AJAX is present in request.GET, set request.is_ajax to False.

process_response(request, response)[source]

Process response.

If GET_PARAM_NAME_FORCE is present in request.GET wrap response in <html><body>{{ response }}</body></html>.

debug_toolbar_force.settings module

Module contents

Indices and tables