代码拉取完成,页面将自动刷新
import os,datetime,json
import traceback
today = datetime.datetime.now().strftime("%Y-%m-%d")
root_path = os.path.split(os.path.realpath(__file__))[0]
log_save_path = root_path + "/logs/"+today+".log"
active = ""
# active = "prod"
# active = "home"
import platform
def get_active_profile():
if active !="":
return "-"+active
return ""
def thirdparty_path():
if platform.system().lower() == 'windows':
return os.path.join(root_path,"thirdparty")+"/chromium/win/chrome.exe"
elif platform.system().lower() == 'linux':
return os.path.join(root_path,"thirdparty")+"/chromium/linux/chrome"
def load_chrome_userdata():
return os.path.join(root_path,"thirdparty")+"/userdata"
def load_config():
config_path = os.path.join(root_path+"/config/config"+get_active_profile()+".json")
with open(config_path,"r") as f:
return json.load(f)
def load_mysql_uri():
config = load_config()
mysql = config["mysql"]
mysql_uri = "mysql+pymysql://"+mysql["user"]+":"+mysql["password"]+"@"+mysql["host"]+":"+str(mysql["port"])+"/"+mysql["dbname"]+"?charset="+mysql["charset"]
return mysql_uri
def load_debug():
config = load_config()
if "debug" in config:
return config["debug"]
else:
return False
def load_htmlroot():
config = load_config()
return config["htmlroot"]
def load_enable_cache_html():
config = load_config()
return config["enable_cache_html"]
def load_temp_save_path():
config = load_config()
return config["tmp"]
def load_qcloud():
config = load_config()
return config["qcloud"]
if __name__ == '__main__':
print(load_config())
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。