Python package for query analysis and monitoring in Django
Project description
Django Query Analyzer
Django Query Analyzer is a Django app that allows you to monitor and analyze the database queries executed by your Django application.
Installation
-
Install the
django-query-analyzerpackage using pip:pip install django-query-analyzer
-
Add "django_query_analyzer" to your
INSTALLED_APPSsetting in your Django project'ssettings.py:INSTALLED_APPS = [ ... 'django_query_analyzer', ]
-
Add "django_query_analyzer.middleware.QueryAnalyzerMiddleware" to your project's
MIDDLEWARElist insettings.py:MIDDLEWARE = [ ... "django_query_analyzer.middleware.QueryAnalyzerMiddleware", ]
-
Register the query analyzer URL patterns in your project's
urls.py:from django.urls import path, include urlpatterns = [ ... path("query-analyzer/", include("django_query_analyzer.urls")), ]
Usage
-
Start your Django development server:
python manage.py runserver
-
Visit the query analyzer dashboard at http://127.0.0.1:8000/query-analyzer/ in your web browser.
Configuration
By default, the query analyzer stores the last 50 executed queries. If you want to control this number, you can add the MAX_QUERY_ANALYZER_RECORDS setting to your project's settings.py. For example, to store the last 100 queries, add the following line to your settings.py:
MAX_QUERY_ANALYZER_RECORDS = 100
Logging to Terminal
You can control logging to the terminal by adding the ENABLE_LOGGING_TO_TERMINAL setting to your project's settings.py. If set to True, query analysis details will be printed to the terminal. To disable terminal logging, set it to `False.
Example configuration in settings.py:
ENABLE_LOGGING_TO_TERMINAL = True
You can control the SQL query to logging the terminal by adding ENABLE_QUERY_LOGGING_ON_CONSOLE to the settings
ENABLE_QUERY_LOGGING_ON_CONSOLE = True
Excluded Paths
You can configure excluded path by configuring the PATHS_TO_EXCLUDE on the settings.py.
by adding the list of path prefixes, you can ignore the execution of query analyzer on the paths. By default query analyzer execute on every paths.
Example configuration in settings.py:
PATHS_TO_EXCLUDE = ['/admin/','/swagger/']
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 Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_query_analyzer-0.0.17.tar.gz.
File metadata
- Download URL: django_query_analyzer-0.0.17.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d80945414620821f3862b475dc0f2a163ca3f2cf7e09682c771654d71b91c6be
|
|
| MD5 |
ca2e62a2ef85cecfbb7c4b293ecd6324
|
|
| BLAKE2b-256 |
5bcc80dbdb8bb69cbdc2d4b59b74c124f9aab12f463189638adf51827a9ea673
|
File details
Details for the file django_query_analyzer-0.0.17-py3-none-any.whl.
File metadata
- Download URL: django_query_analyzer-0.0.17-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49b2b72aeadb9afec457a91f7fc249399dfabab0405a71b6ba4c2117a27bd619
|
|
| MD5 |
189e9dc8947d773225c9ca49ffcd15b6
|
|
| BLAKE2b-256 |
9e1043f86f2219eb3bf829922dc0253d622bc1897d8a436695c8508736ab1acf
|