Django getting error exceptions must derive from BaseException

Info: I want to upload files using Uppy in frontend and django-tus as backend for file processing. I am getting error TypeError: exceptions must derive from BaseException.

Traceback

Internal Server Error: /tus/upload/6393bfe5-277e-4c68-b9af-c0394be796b9
Traceback (most recent call last):
  File "/home/c0d3/git/django-rus-multi-files/env/lib/python3.10/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/home/c0d3/git/django-rus-multi-files/env/lib/python3.10/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/c0d3/git/django-rus-multi-files/env/lib/python3.10/site-packages/django/views/generic/base.py", line 70, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/c0d3/git/django-rus-multi-files/env/lib/python3.10/site-packages/django/utils/decorators.py", line 43, in _wrapper
    return bound_method(*args, **kwargs)
  File "/home/c0d3/git/django-rus-multi-files/env/lib/python3.10/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/home/c0d3/git/django-rus-multi-files/django_tus/views.py", line 37, in dispatch
    return super(TusUpload, self).dispatch(*args, **kwargs)
  File "/home/c0d3/git/django-rus-multi-files/env/lib/python3.10/site-packages/django/contrib/auth/mixins.py", line 71, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/home/c0d3/git/django-rus-multi-files/env/lib/python3.10/site-packages/django/views/generic/base.py", line 98, in dispatch
    return handler(request, *args, **kwargs)
  File "/home/c0d3/git/django-rus-multi-files/django_tus/views.py", line 82, in head
    tus_file = TusFile.get_tusfile_or_404(str(resource_id))
  File "/home/c0d3/git/django-rus-multi-files/django_tus/tusfile.py", line 75, in get_tusfile_or_404
    raise TusResponse(status=404)
TypeError: exceptions must derive from BaseException
[06/Aug/2022 14:36:42] "HEAD /tus/upload/6393bfe5-277e-4c68-b9af-c0394be796b9 HTTP/1.1" 500 103054
[06/Aug/2022 14:36:42,624] - Broken pipe from ('127.0.0.1', 35814)

[06/Aug/2022 14:36:42] "POST /tus/upload/ HTTP/1.1" 201 0
[06/Aug/2022 14:36:42] "PATCH /tus/upload/8295bef4-c94a-4ab7-9c75-2635c74428d8 HTTP/1.1" 204 0

https://github.com/alican/django-tus/blob/master/django_tus/tusfile.py

class TusUpload(View):

    def head(self, request, resource_id):
        tus_file = TusFile.get_tusfile_or_404(str(resource_id))

        return TusResponse(
            status=200,
            extra_headers={
                'Upload-Offset': tus_file.offset,
                'Upload-Length': tus_file.file_size,
            })
def create_initial_file(metadata, file_size: int):
        resource_id = str(uuid.uuid4())
        cache.add("tus-uploads/{}/filename".format(resource_id), "{}".format(metadata.get("filename")), settings.TUS_TIMEOUT)
        cache.add("tus-uploads/{}/file_size".format(resource_id), file_size, settings.TUS_TIMEOUT)
        cache.add("tus-uploads/{}/offset".format(resource_id), 0, settings.TUS_TIMEOUT)
        cache.add("tus-uploads/{}/metadata".format(resource_id), metadata, settings.TUS_TIMEOUT)

        tus_file = TusFile(resource_id)
        tus_file.write_init_file()
        return tus_file
🔴 No definitive solution yet