Metadata-Version: 2.1
Name: django-snakeviz-profiling
Version: 0.1.0
Summary: Integrate snakeviz profile visualization into django
Project-URL: Documentation, https://github.com/rgeoghegan/django-snakeviz-profiling#readme
Project-URL: Issues, https://github.com/rgeoghegan/django-snakeviz-profiling/issues
Project-URL: Source, https://github.com/rgeoghegan/django-snakeviz-profiling
Author-email: Rory Geoghegan <r.geoghegan@gmail.com>
License-Expression: MIT
License-File: LICENSE.txt
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: Django
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development
Requires-Python: >=3.7
Requires-Dist: django>=4.0
Requires-Dist: snakeviz>=2.2
Description-Content-Type: text/markdown

# Django Snakeviz Profiling

[![PyPI - Version](https://img.shields.io/pypi/v/django-snakeviz-profiling.svg)](https://pypi.org/project/django-snakeviz-profiling)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-snakeviz-profiling.svg)](https://pypi.org/project/django-snakeviz-profiling)

-----

Django Snakeviz Profiling integrates [snakeviz](https://pypi.org/project/snakeviz/)
along with a db query display into a django middleware that can show results inline in your application.

No migrations are required nor do any extra url routes need to be added to your application,
only requiring to install one piece of middleware.

**Table of Contents**

- [Installation](#installation)
- [Usage](#usage)
- [License](#license)

## Installation

```console
pip install django-snakeviz-profiling
```

In your settings file, add the following middleware as close to the top as
possible to cover as much code as possible:

    MIDDLEWARE = [
        "django_snakeviz_profiling.SnakevizProfilingMiddleware",
        ...
    ]

Add `django_snakeviz_profiling` to your installed apps:

    INSTALLED_APPS = [
        ...
        "django_snakeviz_profiling",
    ]

Finally, add the following config setting:

    SNAKEVIZ_PROFILING = "PLEASE_PROFILE_REQUESTS"

## Usage

On any request, add the following GET parameter to your url:

    SNAKEVIZ_PROFILING=PLEASE_PROFILE_REQUESTS

, and instead of the regular page, you will be presented with a profile output from the request.

Note that if `django_snakeviz_profiling` is used, individual requests will be dramatically slower,
so be careful using this in prod!

## License

`django-snakeviz-profiling` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
Parts of the code comes from the [Snakeviz Project](https://github.com/jiffyclub/snakeviz/) under
the BSD 3-Clause license, and is specifically identified as such.
