Utilities for Django project.
Project description
Getting Started
Installation
-
Install package
pip install django-gajo-utils
-
Add
GajoDebugUtilsMiddlewareto project settings before all other none-dev related middlewares.MIDDLEWARE = [ 'gajo_utils.middleware.GajoDebugUtilsMiddleware', ... ]
-
Turn on any of the utils by settings its value to
True(by default all utils are disabled)GAJO_UTILS_CONFIG = { "REQUEST_TIMER": False, "REQUEST_DELAY": False, "REQUEST_COOKIES": False, "RESPONSE_COOKIES": False, "RESPONSE_CONTENT": False, "RESPONSE_QUERIES": False, }
Usage
Configuration
"REQUEST_TIMER": True prints in terminal how much time it needed
for request/response cycle to finish.
"REQUEST_DELAY": True adds random delay (50ms - 300ms) to every
request and than prints in terminal how much was request delayed. This
config is used to simulate latency on server.
"REQUEST_COOKIES": True prints in terminal request cookies.
"RESPONSE_COOKIES": True prints in terminal response cookies.
"RESPONSE_CONTENT": True prints in terminal response content.
"RESPONSE_QUERIES": True prints all queries that were made in
response/request cycle with time for each one. It also prints total
time for all queries and number of similar queries (queries that can
be probably optimized with select_related or prefetch_related).
Decorators
Decorator for timing how much time took for view to run. If you want
to time whole request/response cycle than you should use
REQUEST_TIMER configuration.
from gajo_utils.decorators import timeview
@timeview
def example_view(request):
return ...
Function time (function_name): 43.22ms
License
Distributed under the MIT License. See LICENSE.txt for more information.
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_gajo_utils-0.0.1.tar.gz.
File metadata
- Download URL: django_gajo_utils-0.0.1.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ce77757d57013a888afab6ba918d27ca048fe70df15978c4a1b21396cf3d929
|
|
| MD5 |
47ff2b210024540283d5aaa7879a3642
|
|
| BLAKE2b-256 |
586441c2e2650a9e88739e85723ed0487a79782bd3cde346afd4eb004120b63b
|
File details
Details for the file django_gajo_utils-0.0.1-py3-none-any.whl.
File metadata
- Download URL: django_gajo_utils-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d02fed8f641cbc2e5f9f58e012a0c489fb3aef232250c5998b8f166f1452485
|
|
| MD5 |
3c1c1a3b4e7a41f84b84cd8e0a95ac67
|
|
| BLAKE2b-256 |
b3d93e4ebab2a03b0f55c76aec0b3d39b5e4319e2eee185ec6cf79cb093c0cb1
|