Django-集成APK下载

Django集成APK下载。

def installAPK(request):
    filename = 'cfs.apk'
    filepath = os.path.join(os.path.dirname(__file__), filename)   
    wrapper = FileWrapper(file(filepath))
    response = HttpResponse(wrapper, content_type='application/vnd.android.package-archive') 
    response['Content-Disposition'] = 'attachment; filename="cfs.apk"' 
    response['Content-Length'] = os.path.getsize(filepath)
    return response