From d7f9c739668f9a874b56f2f580d4bbc7239585c0 Mon Sep 17 00:00:00 2001 From: jshixiong <2645476194@qq.com> Date: Wed, 14 May 2025 11:37:01 +0800 Subject: [PATCH] fix:env --- app/login_info.py | 2 ++ app/network.py | 2 ++ app/request_info.py | 2 ++ app/route/route.py | 3 +++ app/sys_clean.py | 2 ++ 5 files changed, 11 insertions(+) diff --git a/app/login_info.py b/app/login_info.py index 158f02c..09b8ee6 100644 --- a/app/login_info.py +++ b/app/login_info.py @@ -3,7 +3,9 @@ import os import requests import logging +from dotenv import load_dotenv +load_dotenv() ruby_recent_login_url = os.getenv("RUBY_RECENT_LOGIN_URL", "http://test-data.educoder.net/api/home/online_users.json") ruby_oline_size_url = os.getenv("RUBY_ONLINE_SIZE_URL", "http://test-data.educoder.net/api/home/online_num") diff --git a/app/network.py b/app/network.py index 75cc993..839ba79 100644 --- a/app/network.py +++ b/app/network.py @@ -4,7 +4,9 @@ import time import os from datetime import datetime, timedelta from collections import deque +from dotenv import load_dotenv +load_dotenv() log_file_path = os.getenv("NET_SPEED_PATH", '/data/ww/py_sys_monitor/info/net_speed') def ensure_log_file_exists(): diff --git a/app/request_info.py b/app/request_info.py index 68e1dd5..b412453 100644 --- a/app/request_info.py +++ b/app/request_info.py @@ -1,6 +1,8 @@ import os import json +from dotenv import load_dotenv +load_dotenv() log_file_path = os.getenv("ACCESS_LOG_PATH", '/data/ww/py_sys_monitor/info/access_log') def get_request_info(page_index=1, page_size=10): diff --git a/app/route/route.py b/app/route/route.py index 7cbc5cf..c7fa48b 100644 --- a/app/route/route.py +++ b/app/route/route.py @@ -10,6 +10,9 @@ import app.request_info as request_info import app.imitate_thread as imitate_thread import app.sys_clean as sys_clean import app.sys_control as sys_control +from dotenv import load_dotenv + +load_dotenv() route_bp = Blueprint('route', __name__) diff --git a/app/sys_clean.py b/app/sys_clean.py index 6b259e9..4593efe 100644 --- a/app/sys_clean.py +++ b/app/sys_clean.py @@ -5,7 +5,9 @@ import random import string from flask import jsonify import logging +from dotenv import load_dotenv +load_dotenv() log_directory = os.getenv("JUNK_PATH", '/data/ww/py_sys_monitor/logs/junk') def get_junk_file():