Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #432 from Bidaya0/developmet/add-cprofile-middleware
Browse files Browse the repository at this point in the history
add cprofile-middleware
  • Loading branch information
Bidaya0 authored Jan 22, 2022
2 parents 9bfc475 + d0774e3 commit e916da1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ services:
- SAVEEYE=TRUE
- PROJECT_NAME=LocalWEBAPI
- LOG_PATH=/tmp/dongtai-agent-python.log
- CPROFILE=TRUE
volumes:
- .:/opt/dongtai/webapi/

Expand Down
2 changes: 0 additions & 2 deletions requirements-prod.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,4 @@ xlwt==1.3.0
uwsgi==2.0.19.1
pyre2~=0.3.6
jq
ddt
faker
https://huoqi-public.oss-cn-beijing.aliyuncs.com/iast/dongtai-latest.tar.gz
1 change: 1 addition & 0 deletions requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ https://huoqi-public.oss-cn-beijing.aliyuncs.com/iast/dongtai-test-latest.tar.gz
ddt
faker
jq
django-cprofile-middleware
7 changes: 7 additions & 0 deletions webapi/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,13 @@ def safe_execute(default, exception, function, *args):
REST_FRAMEWORK[
'DEFAULT_SCHEMA_CLASS'] = 'drf_spectacular.openapi.AutoSchema'


if os.getenv('environment', None) == 'TEST' or os.getenv('CPROFILE',
None) == 'TRUE':
DJANGO_CPROFILE_MIDDLEWARE_REQUIRE_STAFF = False
MIDDLEWARE.append(
'django_cprofile_middleware.middleware.ProfilerMiddleware')

SCA_BASE_URL = config.get('sca', 'base_url')

if os.getenv('environment', None) in ('TEST', 'PROD'):
Expand Down

0 comments on commit e916da1

Please sign in to comment.