Jelajahi Sumber

!2 add no cache

pcacc 3 bulan lalu
induk
melakukan
791ebcdf70
2 mengubah file dengan 6 tambahan dan 1 penghapusan
  1. 4 0
      app_dongri.py
  2. 2 1
      requirements.txt

+ 4 - 0
app_dongri.py

@@ -10,11 +10,15 @@ from dongri_task import *
 from collections import deque
 import json
 from concurrent.futures import ThreadPoolExecutor
+from flask_caching import Cache
 
 # 全局线程池,限制最大线程数为1
 executor = ThreadPoolExecutor(max_workers=1)
 
+cache = Cache(config={'CACHE_TYPE': 'null'})  # 使用 null 缓存类型
 app = Flask(__name__)
+cache.init_app(app)
+app.config['TEMPLATES_AUTO_RELOAD'] = True
 socketio = SocketIO(app, cors_allowed_origins="*")
 event = threading.Event()
 g_status_list = []

+ 2 - 1
requirements.txt

@@ -20,4 +20,5 @@ simple-websocket
 paddleocr
 paddlepaddle
 setuptools
-python-logging-loki[async]
+python-logging-loki[async]
+Flask-Caching