From cfd4235a2b0575af666304953b41108f94a37793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E5=89=8D=E6=98=8E?= <909355014@qq.com> Date: Mon, 19 Sep 2022 18:05:48 +0800 Subject: [PATCH] =?UTF-8?q?apk=20=E4=B8=8A=E4=BC=A0bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/system/views.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/apps/system/views.py b/apps/system/views.py index ffebcd26..95e98ab5 100755 --- a/apps/system/views.py +++ b/apps/system/views.py @@ -628,10 +628,8 @@ class ApkView(MyLoggingMixin, ListCreateAPIView): vdata = sr.validated_data config.set("apk", "version", vdata['version']) config.set("apk", "file", vdata['file']) - config.write(open(os.path.join(settings.BASE_DIR, 'server/conf.ini'), 'w')) + with open(os.path.join(settings.BASE_DIR, 'server/conf.ini'), 'w') as f: + config.write(f) from shutil import copyfile - try: - copyfile(settings.BASE_DIR + vdata['file'], settings.BASE_DIR + '/media/zc_ehs.apk') - except Exception: - pass + copyfile(settings.BASE_DIR + vdata['file'], settings.BASE_DIR + '/media/zc_ehs.apk') return Response()