def sendfile(request, filename, attachment=False, attachment_filename=None,
             mimetype=None, encoding=None):
    view = PathDownloadView.as_view(path=filename,
                                    attachment=attachment,
                                    basename=attachment_filename,
                                    mimetype=mimetype,
                                    encoding=encoding)
    return view(request)
Port of django-sendfile's API in django-downloadview.
dataset/ETHPy150Open benoitbryon/django-downloadview/django_downloadview/shortcuts.py/sendfile