You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
968 B
24 lines
968 B
10 months ago
|
from quart import Blueprint, render_template, request, redirect, url_for, flash, current_app
|
||
|
import os
|
||
|
import subprocess
|
||
|
from werkzeug.utils import secure_filename
|
||
|
from myutils.ConfigManager import myCongif
|
||
|
|
||
|
def allowed_file(filename):
|
||
|
return '.' in filename and filename.rsplit('.', 1)[1].lower() in myCongif.get_data('ALLOWED_EXTENSIONS')
|
||
|
|
||
|
#对上传的系统升级包进行检查 type:1--系统升级包,2--算法升级包
|
||
|
def check_file(filepath,type):
|
||
|
pass
|
||
|
|
||
|
def update_system(filepath): #系统升级
|
||
|
pass
|
||
|
|
||
|
def updata_model(filepath): #算法模型升级或新增
|
||
|
try:
|
||
|
# 假设我们解压并运行一个升级脚本
|
||
|
subprocess.run(['unzip', '-o', filepath, '-d', '/path/to/upgrade/directory'], check=True)
|
||
|
subprocess.run(['/path/to/upgrade/directory/upgrade_script.sh'], check=True)
|
||
|
return True, 'Upgrade completed successfully.'
|
||
|
except subprocess.CalledProcessError as e:
|
||
|
return False, str(e)
|