diff --git a/cvat/requirements/development.txt b/cvat/requirements/development.txt index 9c39e8e4..fea2fb3b 100644 --- a/cvat/requirements/development.txt +++ b/cvat/requirements/development.txt @@ -12,4 +12,3 @@ wrapt==1.10.11 django-extensions==2.0.6 Werkzeug==0.14.1 snakeviz==0.4.2 -django-silk==3.0.1 diff --git a/cvat/requirements/staging.txt b/cvat/requirements/staging.txt index d7f1e2f9..6fefa087 100644 --- a/cvat/requirements/staging.txt +++ b/cvat/requirements/staging.txt @@ -1 +1,2 @@ -r production.txt +django-silk==3.0.1 \ No newline at end of file diff --git a/cvat/settings/development.py b/cvat/settings/development.py index 33e6679f..8c1b8ee8 100644 --- a/cvat/settings/development.py +++ b/cvat/settings/development.py @@ -9,34 +9,8 @@ DEBUG = True INSTALLED_APPS += [ 'django_extensions', - 'silk' ] -MIDDLEWARE += [ - 'silk.middleware.SilkyMiddleware', -] - -# Django profiler -# https://github.com/jazzband/django-silk -SILKY_PYTHON_PROFILER = True -SILKY_PYTHON_PROFILER_BINARY = True -SILKY_PYTHON_PROFILER_RESULT_PATH = os.path.join(BASE_DIR, 'profiles/') -os.makedirs(SILKY_PYTHON_PROFILER_RESULT_PATH, exist_ok=True) -SILKY_AUTHENTICATION = True -SILKY_AUTHORISATION = True -SILKY_MAX_REQUEST_BODY_SIZE = 1024 -SILKY_MAX_RESPONSE_BODY_SIZE = 1024 -SILKY_IGNORE_PATHS = ['/admin', '/documentation', '/django-rq', '/auth'] -SILKY_MAX_RECORDED_REQUESTS = 10**4 -def SILKY_INTERCEPT_FUNC(request): - # Ignore all requests which try to get a frame (too many of them) - if request.method == 'GET' and '/frame/' in request.path: - return False - - return True - -SILKY_INTERCEPT_FUNC = SILKY_INTERCEPT_FUNC - # Django-sendfile: # https://github.com/johnsensible/django-sendfile SENDFILE_BACKEND = 'sendfile.backends.development' diff --git a/cvat/settings/staging.py b/cvat/settings/staging.py index 075e8a25..46ddeb8c 100644 --- a/cvat/settings/staging.py +++ b/cvat/settings/staging.py @@ -8,4 +8,31 @@ from .production import * # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True +INSTALLED_APPS += [ + 'silk' +] +MIDDLEWARE += [ + 'silk.middleware.SilkyMiddleware', +] + +# Django profiler +# https://github.com/jazzband/django-silk +SILKY_PYTHON_PROFILER = True +SILKY_PYTHON_PROFILER_BINARY = True +SILKY_PYTHON_PROFILER_RESULT_PATH = os.path.join(BASE_DIR, 'profiles/') +os.makedirs(SILKY_PYTHON_PROFILER_RESULT_PATH, exist_ok=True) +SILKY_AUTHENTICATION = True +SILKY_AUTHORISATION = True +SILKY_MAX_REQUEST_BODY_SIZE = 1024 +SILKY_MAX_RESPONSE_BODY_SIZE = 1024 +SILKY_IGNORE_PATHS = ['/admin', '/documentation', '/django-rq', '/auth'] +SILKY_MAX_RECORDED_REQUESTS = 10**4 +def SILKY_INTERCEPT_FUNC(request): + # Ignore all requests which try to get a frame (too many of them) + if request.method == 'GET' and '/frame/' in request.path: + return False + + return True + +SILKY_INTERCEPT_FUNC = SILKY_INTERCEPT_FUNC