Skip to content

Commit

Permalink
Move silk to staging config. (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
nmanovic authored Nov 26, 2018
1 parent b0c84f4 commit af894e1
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 27 deletions.
1 change: 0 additions & 1 deletion cvat/requirements/development.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions cvat/requirements/staging.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
-r production.txt
django-silk==3.0.1
26 changes: 0 additions & 26 deletions cvat/settings/development.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,8 @@

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'
Expand Down
27 changes: 27 additions & 0 deletions cvat/settings/staging.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,31 @@
# 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

0 comments on commit af894e1

Please sign in to comment.