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
YI wechat
欢迎您扫一扫上面的微信公众号,订阅我的博客!