Simple SQL Middleware for Django
Project description
Django SQL Middleware
A simple middleware aimed to capture all queries in a request and provide basic SQL profiling such as execution time, execution plan, and query traceback.
This package is only intended to run in development mode for non-sqlite database.
Currently, this package only tested in projects that uses psycopg2 (postgres) as default database engine.
How To Install
-
Get the package from pypi:
pip install django-sql-middleware
-
In
settings.py
add:INSTALLED_APPS = [ # your other apps "sqlmiddleware" ] MIDDLEWARE = [ # your other middlewares ] if DEBUG: MIDDLEWARE.append("sqlmiddleware.middlewares.LogSQLMiddleware")
-
Register urls in
your_project/urls.py
:from django.urls import include, path urlpatterns = [ # other urls, path("__sql/", include("sqlmiddleware.urls")), ]
-
Run
collectstatic
to serve included css and js assets:./manage.py collectstatic
-
Start the development server:
./manage.py runserver
-
you should be able to access
localhost:8000/__sql
in your browser.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size django_sql_middleware-0.0.7-py3-none-any.whl (111.2 kB) | File type Wheel | Python version py3 | Upload date | Hashes View |
Filename, size django-sql-middleware-0.0.7.tar.gz (106.6 kB) | File type Source | Python version None | Upload date | Hashes View |
Hashes for django_sql_middleware-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a10d849122694ddedb35f9b8cdd2e1755453626836b4863ee181bd90e2b4c564 |
|
MD5 | 8a7a63cecd626044b2aa47359002289d |
|
BLAKE2-256 | e1d8688f1622d5e86215b0b3161dbde179a2bf784d605723d2ff8304ceeabb9d |
Hashes for django-sql-middleware-0.0.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 884cb3c2ff44d6fc26494655d3bb24859a04c6b15f56a03b4498b2d950547075 |
|
MD5 | d7d27c87214da56e93b059497f574b5b |
|
BLAKE2-256 | 9118fddfd79e24fab330c66c7786e061c12bccd7b2615d88f82d29e5cc7eaaa5 |