Source

fromdjango.confimportsettingsfromdjango.httpimportHttpResponseRedirectfromdjango.utils.encodingimportsmart_strdefserve_file(request,file,save_as,content_type):""" Redirects downloads to a handler at settings.FILETRANSFERS_BASE_REDIRECT_URL """returnHttpResponseRedirect(smart_str(settings.FILETRANSFERS_BASE_REDIRECT_URL+file.name))