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.
Source Distribution
Built Distribution
Hashes for django-sql-middleware-0.0.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ea59fceeab494887d5f686892ee710f66d4efb4dafb46b7b128e108412a70ae |
|
MD5 | 4916c438ec5abd23e956405afc437c67 |
|
BLAKE2b-256 | 06660e6297c09f958565392d1d30b592d91ef951ed66ed8dadc8238c2700f2fe |
Hashes for django_sql_middleware-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c08dd84c06542d9a56fbe98b02eacd02b67134d0df54f906a05a36089bbc2d42 |
|
MD5 | 8e613995ca01e416664317cc312348f4 |
|
BLAKE2b-256 | 1a99e53f8dce4a6f809a42c638aa387ae451b093432afd9bc1fb81498eddebc9 |