mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add support for django-query-count (#6948)
* Add support for django-query-count * Display duplicate queries * Add comment in settings.py
This commit is contained in:
parent
fddcb629b6
commit
7ca420ebdc
@ -268,6 +268,26 @@ MIDDLEWARE = CONFIG.get(
|
||||
],
|
||||
)
|
||||
|
||||
# In DEBUG mode, add support for django-querycount
|
||||
# Ref: https://github.com/bradmontgomery/django-querycount
|
||||
if DEBUG and get_boolean_setting(
|
||||
'INVENTREE_DEBUG_QUERYCOUNT', 'debug_querycount', False
|
||||
):
|
||||
MIDDLEWARE.append('querycount.middleware.QueryCountMiddleware')
|
||||
|
||||
QUERYCOUNT = {
|
||||
'THRESHOLDS': {
|
||||
'MEDIUM': 50,
|
||||
'HIGH': 200,
|
||||
'MIN_TIME_TO_LOG': 0,
|
||||
'MIN_QUERY_COUNT_TO_LOG': 0,
|
||||
},
|
||||
'IGNORE_REQUEST_PATTERNS': ['^(?!\/(api)?(plugin)?\/).*'],
|
||||
'IGNORE_SQL_PATTERNS': [],
|
||||
'DISPLAY_DUPLICATES': 3,
|
||||
'RESPONSE_HEADER': 'X-Django-Query-Count',
|
||||
}
|
||||
|
||||
AUTHENTICATION_BACKENDS = CONFIG.get(
|
||||
'authentication_backends',
|
||||
[
|
||||
|
@ -2,6 +2,7 @@
|
||||
-c requirements.txt
|
||||
coverage[toml] # Unit test coverage
|
||||
coveralls==2.1.2 # Coveralls linking (for tracking coverage) # PINNED 2022-06-28 - Old version needed for correct upload
|
||||
django-querycount # Display number of URL queries for requests
|
||||
django-slowtests # Show which unit tests are running slowly
|
||||
django-test-migrations # Unit testing for database migrations
|
||||
isort # python import sorting
|
||||
|
@ -25,6 +25,7 @@ distlib==0.3.8
|
||||
# via virtualenv
|
||||
django==4.2.11
|
||||
# via django-slowtests
|
||||
django-querycount==0.8.3
|
||||
django-slowtests==1.1.1
|
||||
django-test-migrations==1.3.0
|
||||
docopt==0.6.2
|
||||
|
Loading…
Reference in New Issue
Block a user