Skip to content

Commit

Permalink
used maintained django_sendfile2 package instead of django sendfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Zhavoronkov committed Jan 31, 2022
1 parent 8864a77 commit 93b0edc
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cvat/apps/engine/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from rest_framework.parsers import JSONParser
from rest_framework.renderers import JSONRenderer
from rest_framework.response import Response
from sendfile import sendfile
from django_sendfile import sendfile

import cvat.apps.dataset_manager as dm
from cvat.apps.engine import models
Expand Down
2 changes: 1 addition & 1 deletion cvat/apps/engine/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from rest_framework.renderers import JSONRenderer
from rest_framework.response import Response
from rest_framework.exceptions import PermissionDenied
from sendfile import sendfile
from django_sendfile import sendfile

import cvat.apps.dataset_manager as dm
import cvat.apps.dataset_manager.views # pylint: disable=unused-import
Expand Down
2 changes: 1 addition & 1 deletion cvat/apps/opencv/views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import glob
from django.conf import settings
from sendfile import sendfile
from django_sendfile import sendfile

def OpenCVLibrary(request):
dirname = os.path.join(settings.STATIC_ROOT, 'opencv', 'js')
Expand Down
2 changes: 1 addition & 1 deletion cvat/requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ requests==2.26.0
rq==1.5.1
rq-scheduler==0.10.0
sqlparse==0.4.2
django-sendfile==0.3.11
django-sendfile2==0.6.1
dj-pagination==2.5.0
python-logstash-async==2.2.0
django-revproxy==0.10.0
Expand Down
7 changes: 6 additions & 1 deletion cvat/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def add_ssh_keys():
'django.contrib.staticfiles',
'django_rq',
'compressor',
'sendfile',
'django_sendfile',
'dj_pagination',
'revproxy',
'rest_framework',
Expand Down Expand Up @@ -498,3 +498,8 @@ def add_ssh_keys():
# More about forwarded headers - https://doc.traefik.io/traefik/getting-started/faq/#what-are-the-forwarded-headers-when-proxying-http-requests
# How django uses X-Forwarded-Proto - https://docs.djangoproject.com/en/2.2/ref/settings/#secure-proxy-ssl-header
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')


# Django-sendfile requires to set SENDFILE_ROOT
# https://github.com/moggers87/django-sendfile2
SENDFILE_ROOT = BASE_DIR
4 changes: 2 additions & 2 deletions cvat/settings/development.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
ALLOWED_HOSTS.append('testserver')

# Django-sendfile:
# https://github.com/johnsensible/django-sendfile
SENDFILE_BACKEND = 'sendfile.backends.development'
# https://github.com/moggers87/django-sendfile2
SENDFILE_BACKEND = 'django_sendfile.backends.development'

# Database
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
Expand Down
4 changes: 2 additions & 2 deletions cvat/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
RQ_QUEUES[key]['HOST'] = os.getenv('CVAT_REDIS_HOST', 'cvat_redis')

# Django-sendfile:
# https://github.com/johnsensible/django-sendfile
SENDFILE_BACKEND = 'sendfile.backends.xsendfile'
# https://github.com/moggers87/django-sendfile2
SENDFILE_BACKEND = 'django_sendfile.backends.xsendfile'

# Database
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
Expand Down

0 comments on commit 93b0edc

Please sign in to comment.