A simplified version of django-devserver limited to SQL tracing and Ajax dump.
Project description
A simplified version of django-devserver limited to SQL tracing and Ajax dump.
Motivations
django-devserver is a very nice and usefull package, but the project isn’t very active, and occasional problems related to new Django versions stay unfixed for long time even when a solution is available as PR.
Being mostly interested in tracing db queries, I finally decided to package a stripped down version of the project.
Screenshots
Quickstart
Install django-query-tracer:
pip install django-query-tracer
Add it to your INSTALLED_APPS:
INSTALLED_APPS = (
...
'query_tracer',
...
)
Add django-query-tracer’s middleware:
MIDDLEWARE_CLASSES = [
...
'query_tracer.middleware.QueryTracerMiddleware',
...
]
Sample local setup for development
# Install query_tracer
INSTALLED_APPS.append('query_tracer')
MIDDLEWARE_CLASSES += [
'query_tracer.middleware.QueryTracerMiddleware',
]
QUERYTRACER_MODULES = (
'query_tracer.modules.sql.SQLRealTimeModule',
'query_tracer.modules.sql.SQLSummaryModule',
'query_tracer.modules.ajax.AjaxDumpModule',
'query_tracer.modules.time.TimeModule',
)
Features
See file “query_tracer/settings.py” for available options, and refer to django-devserver doc for usage/
Time module
A simple TimeModule module has been added to display the time required to process each Django view.
Utility functions
- query_traces.utils.trace.trace
Prints a text message or list, optionally prettified
- query_traces.utils.trace.prettyprint_query
Format and print a generic SQL query
- query_traces.utils.trace.prettyprint_queryset
Format and print a queryset’s query
- query_traces.utils.trace.trace_func
Prints function calls, showing actual parameters; to be used as decorator
- query_traces.utils.time.ms_from_timedelta
Returns timedelta in milliseconds
Credits
This project is a stripped down version of:
Tools used in rendering this package:
0.1.5
Mimic SQLSummaryModule on completion of SQLRealTimeModule
0.1.4
TimeModule added
0.1.3
Prepare for Python3
Enhanced sql summary logging
0.1.2
Default settings more suitable for production
0.1.1
Version comparison fix required after Django 1.10 to solve “maximum recursion depth exceeded on Django 1.10 #132” issue
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for django_query_tracer-0.1.6-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbf935a451e54ab89b01d63baa5e7af6497bd9cd14f3398386f8149dc816f2c9 |
|
MD5 | 8123dc040b9739a8811e51e2eec1a5c1 |
|
BLAKE2b-256 | 7b96412da1f28e45287fd680ce1706eae962dcda89da83e06a25a296119717c5 |