I found two errors depending on what django_sendfile expects when called from daiquiri.files.
in the _sanitize_path function -> SENDFILE_ROOT not implemented.
Internal Server Error: /files/qparchive/test_5/l1/qmost_05134899-2212263_20220906_100150_LB1.fits
Traceback (most recent call last):
File "xxx/venv3/lib/python3.8/site-packages/django_sendfile/utils.py", line 44, in _sanitize_path
path_root = Path(getattr(settings, 'SENDFILE_ROOT', None))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "xxx/venv3/lib/python3.8/site-packages/daiquiri/files/views.py", line 49, in get
return send_file(request, file_path)
File "xxx/venv3/lib/python3.8/site-packages/daiquiri/files/utils.py", line 100, in send_file
return sendfile(request, absolute_file_path)
File "xxx/venv3/lib/python3.8/site-packages/django_sendfile/utils.py", line 85, in sendfile
filepath_obj = _sanitize_path(filename)
File "xxx/venv3/lib/python3.8/site-packages/django_sendfile/utils.py", line 46, in _sanitize_path
raise ImproperlyConfigured('You must specify a value for SENDFILE_ROOT')
django.core.exceptions.ImproperlyConfigured: You must specify a value for SENDFILE_ROOT
ERROR - Internal Server Error: /files/qparchive/test_5/l1/qmost_05134899-2212263_20220906_100150_LB1.fits
2. in the `_get_sendfile()` function trying to import the `backend = getattr(settings, 'SENDFILE_BACKEND', None)` value.
ModuleNotFoundError: No module named 'sendfile'
File "xxx/venv3/lib/python3.8/site-packages/django_sendfile/utils.py", line 88, in sendfile
_sendfile = _get_sendfile()
File "xxx/venv3/lib/python3.8/site-packages/django_sendfile/utils.py", line 21, in _get_sendfile
module = import_module(backend)
In short:
* `_sanitize_path` needs `SENDFILE_ROOT` and I didn't find it among the daiquiri settings.
* In daiquiri.core.settings.django the `SENDFILE_BACKEND = env.get('SENDFILE_BACKEND', 'sendfile.backends.simple')` line looks not updated to the new module.
So in my local branch I fixed adding these lines to my settings:
Trying to serve files via
daiquiri.files
module I noticed that there is a problem that I believe related to the change of sendfile module occurred at this commit: https://github.com/django-daiquiri/daiquiri/commit/bbfb9954cbc62140b81ebc2e423336af11da0fffI found two errors depending on what
django_sendfile
expects when called fromdaiquiri.files
._sanitize_path
function ->SENDFILE_ROOT
not implemented.During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "xxx/venv3/lib/python3.8/site-packages/daiquiri/files/views.py", line 49, in get return send_file(request, file_path) File "xxx/venv3/lib/python3.8/site-packages/daiquiri/files/utils.py", line 100, in send_file return sendfile(request, absolute_file_path) File "xxx/venv3/lib/python3.8/site-packages/django_sendfile/utils.py", line 85, in sendfile filepath_obj = _sanitize_path(filename) File "xxx/venv3/lib/python3.8/site-packages/django_sendfile/utils.py", line 46, in _sanitize_path raise ImproperlyConfigured('You must specify a value for SENDFILE_ROOT') django.core.exceptions.ImproperlyConfigured: You must specify a value for SENDFILE_ROOT ERROR - Internal Server Error: /files/qparchive/test_5/l1/qmost_05134899-2212263_20220906_100150_LB1.fits
ModuleNotFoundError: No module named 'sendfile'
File "xxx/venv3/lib/python3.8/site-packages/django_sendfile/utils.py", line 88, in sendfile _sendfile = _get_sendfile() File "xxx/venv3/lib/python3.8/site-packages/django_sendfile/utils.py", line 21, in _get_sendfile module = import_module(backend)
SENDFILE_ROOT = FILES_BASE_PATH SENDFILE_BACKEND = 'django_sendfile.backends.simple'