Skip to content

Commit

Permalink
feat: 请求支持异步
Browse files Browse the repository at this point in the history
  • Loading branch information
linyuan0213 committed Nov 17, 2024
1 parent b631312 commit 1c2ec89
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 83 deletions.
12 changes: 5 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,17 @@ DrissionPage==4.1.0.9
executing==1.1.0
fast-bencode==1.1.6
feapder==1.9.0
Flask==2.2.5
flask[async]==3.1.0
Flask-Login==0.6.3
flask-compress==1.13
flask-restx==1.0.6
flask-sock==0.6.0
flask-compress==1.17
flask-restx==1.3.0
flask-sock==0.7.0
flask-session==0.8.0
flask-caching==2.1.0
flask-caching==2.3.0
func_timeout==4.3.5
humanize==4.4.0
icalendar==5.0.4
influxdb==5.3.1
itsdangerous==2.1.2
iso639==0.1.4
jedi==0.18.1
Jinja2==3.1.4
Expand Down Expand Up @@ -86,5 +85,4 @@ tzlocal==4.2
urllib3==2.2.2
watchdog==2.1.9
websockets==10.3
Werkzeug==3.0.6
zhconv==1.4.3
29 changes: 2 additions & 27 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import hashlib
import random

from config_monitor import stop_config_monitor, start_config_monitor

warnings.filterwarnings('ignore')

# 运行环境判断
Expand All @@ -30,9 +32,6 @@
import log
from web.action import WebAction
from web.main import App
from app.db import init_db, update_db, init_data
from initializer import update_config, check_config, start_config_monitor, stop_config_monitor
from version import APP_VERSION


def sigal_handler(num, stack):
Expand Down Expand Up @@ -84,30 +83,6 @@ def get_run_config(forcev4=False):
signal.signal(signal.SIGINT, sigal_handler)
signal.signal(signal.SIGTERM, sigal_handler)


# 系统初始化
@App.before_first_request
def init_system():
# 配置
log.console('NAStool 当前版本号:%s' % APP_VERSION)
# 数据库初始化
init_db()
# 数据库更新
update_db()
# 数据初始化
init_data()
# 升级配置文件
update_config()
# 检查配置文件
check_config()


# 启动服务
@App.before_first_request
def start_service():
log.console("开始启动服务...")
# 启动服务
WebAction.start_service()
# 调试用
if os.environ.get('FLASK_DEBUG') == "1":
os.environ['SERVER_INSTANCE'] = hashlib.md5(str(random.random()).encode()).hexdigest()
Expand Down
2 changes: 1 addition & 1 deletion web/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -4986,7 +4986,7 @@ def install_plugin(data, reload=True):
user_plugins = SystemConfig().get(SystemConfigKey.UserInstalledPlugins) or []
if module_id not in user_plugins:
user_plugins.append(module_id)
PluginHelper.install(module_id)
# PluginHelper.install(module_id)
# 保存配置
SystemConfig().set(SystemConfigKey.UserInstalledPlugins, user_plugins)
# 重新加载插件
Expand Down
Loading

0 comments on commit 1c2ec89

Please sign in to comment.