From 06307c6384f6b56d69bb08525991f722d37e8d72 Mon Sep 17 00:00:00 2001 From: MarkusJoe Date: Sat, 19 Feb 2022 11:05:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=88=A4=E6=96=AD./bin/log?= =?UTF-8?q?=E5=86=85=E6=97=A5=E5=BF=97=E6=96=87=E4=BB=B6=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E8=B6=85=E8=BF=87=E9=98=88=E5=80=BC=E5=88=99=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app.py b/app.py index e9add49..08eabfa 100644 --- a/app.py +++ b/app.py @@ -63,6 +63,15 @@ def requests_log() -> None: for i in file_list: os.remove(f'./static/cache/{i}') + origin_log_list = os.listdir('./bin/log') + origin_log_list.remove('.gitkeep') + if len(origin_log_list) > 10: + for d in origin_log_list: + try: + os.remove(f'./bin/log/{d}') + except PermissionError: + pass + @app.errorhandler(404) def miss(reason) -> Response: