提交 05d3c65e 编写于 作者: H hjdhnx

修复bug

上级 d0dc7085
......@@ -31,12 +31,12 @@ def create_flask_app():
wlan_info,_ = get_wlan_info()
logger.info(rule_list)
logger.info(f'局域网: {getHost(1, app.config.get("HTTP_PORT"))}/index\n本地: {getHost(0, app.config.get("HTTP_PORT"))}/index\nwlan_info:{wlan_info}')
db.init_app(app)
db.app = app
db.create_all(app=app)
return app
app = create_flask_app()
db.init_app(app)
db.app = app
db.create_all(app=app)
migrate = Migrate(app, db)
now_python_ver = ".".join([str(i) for i in sys.version_info[:3]])
......
无法预览此类型文件
......@@ -8,6 +8,9 @@ import os
from flask import Blueprint,request,render_template,jsonify,make_response
from controllers.service import storage_service,rules_service
from base.R import R
from base.database import db
from utils.log import logger
import shutil
from utils.update import getLocalVer,getOnlineVer,download_new_version,download_lives,copy_to_update
from utils import parser
from utils.web import getParmas,verfy_token
......@@ -97,12 +100,17 @@ def admin_update_db():
if not verfy_token():
# return render_template('login.html')
return R.error('请登录后再试')
old_dbfile = 'migrations'
if os.path.exists(old_dbfile):
logger.info(f'开始删除历史数据库迁移文件:{old_dbfile}')
shutil.rmtree(old_dbfile)
db.session.execute('drop table if exists alembic_version')
cmd = 'flask db migrate && flask db upgrade'
if not os.path.exists('migrations'):
cmd = 'flask db init && '+cmd
print(f'开始执行cmd:{cmd}')
logger.info(f'开始执行cmd:{cmd}')
result = os.system(cmd)
print(f'cmd执行结果:{result}')
logger.info(f'cmd执行结果:{result}')
return R.success('数据库升级完毕')
@admin.route('/update_ver')
......
......@@ -254,21 +254,22 @@ def config_gen():
# print(set_local)
set_area = render_template('config.txt',pys=pys,rules=rules,alists=alists,alists_str=alists_str,live_url=get_live_url(new_conf,1),mode=1,host=getHost(1),jxs=jxs)
set_online = render_template('config.txt',pys=pys,rules=rules,alists=alists,alists_str=alists_str,live_url=get_live_url(new_conf,2),mode=1,host=getHost(2),jxs=jxs)
ali_token = new_conf.ALI_TOKEN
with open('txt/pycms0.json','w+',encoding='utf-8') as f:
customConfig = getCustonDict(getHost(0))
customConfig = getCustonDict(getHost(0),ali_token)
set_dict = custom_merge(parseText(set_local), customConfig)
merged_hide(set_dict)
# set_dict = json.loads(set_local)
f.write(json.dumps(set_dict,ensure_ascii=False,indent=4))
with open('txt/pycms1.json','w+',encoding='utf-8') as f:
customConfig = getCustonDict(getHost(1))
customConfig = getCustonDict(getHost(1),ali_token)
set_dict = custom_merge(parseText(set_area), customConfig)
merged_hide(set_dict)
# set_dict = json.loads(set_area)
f.write(json.dumps(set_dict,ensure_ascii=False,indent=4))
with open('txt/pycms2.json','w+',encoding='utf-8') as f:
customConfig = getCustonDict(getHost(2))
customConfig = getCustonDict(getHost(2),ali_token)
set_dict = custom_merge(parseText(set_online), customConfig)
merged_hide(set_dict)
# set_dict = json.loads(set_online)
......
3.7.2
\ No newline at end of file
3.7.3
\ No newline at end of file
......@@ -46,6 +46,8 @@
[dockerfile教程](https://blog.csdn.net/qq_46158060/article/details/125718218)
[获取本地设备信息](https://blog.csdn.net/cui_yonghua/article/details/125508991)
[获取本地设备信息](https://m.jb51.net/article/140716.htm)
###### 2022/09/22
- [X] 1.v3.7.3修复静态文件阿里token没渲染的bug,修复数据库升级bug,优化app.py
###### 2022/09/21
- [X] 1.未来功能增加显示和隐藏多选规则的实际逻辑,增加顺序字段等待有缘人
- [X] 2.版本升级至3.7.0
......
......@@ -47,7 +47,7 @@
console.log(this);
});
$('#update_db').click(function (){
if(confirm('确定要升级数据库?判断标准为是否正常打开缓存文件列表-查看界面,如果正常就不需要进行此操作。升级数据库后将正常使用未来功能多选操作,可对规则进行多选显示或者隐藏')){
if(confirm('确定要升级数据库?升级过程可能较长,需要耐心等待提示完成。判断标准为是否正常打开缓存文件列表-查看界面,如果正常就不需要进行此操作。升级数据库后将正常使用未来功能多选操作,可对规则进行多选显示或者隐藏')){
$.get("/admin/update_db",function(data,status){
console.log(data);
if(data.code === 200){
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册