Skip to content

Commit db92c63

Browse files
committed
feat(mc_server): 重构 mc_server 插件
feat(config): 自动检查依赖包是否安装, Docker 镜像自动安装 mysql、sqlite 依赖
1 parent fe391fc commit db92c63

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

app/core/config.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def __init__(self):
4747
'password': self.cf.get('database', 'password')
4848
}
4949
else:
50-
import wfewfwefg
50+
import sqlite3
5151
self.DB_PARAMS = {}
5252
if not self.DB_NAME.endswith('.db'):
5353
self.DB_NAME += '.db'
@@ -81,7 +81,11 @@ def __init__(self):
8181
exit()
8282
except ImportError as e:
8383
logger.error("依赖包缺少: %r" % e.name)
84-
logger.error("请尝试运行 'pip install %s' 安装该依赖包后重新启动!" % e.name)
84+
if e.name == 'pymysql':
85+
cmd = 'pip install pymysql'
86+
else:
87+
cmd = 'pip install pysqlite3'
88+
logger.error("请尝试运行 '%s' 安装该依赖包后重新启动!" % cmd)
8589
exit()
8690

8791
def change_debug(self):

k8s/images/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ COPY Madoka .
1111

1212
RUN apt-get update && apt-get install git -y && \
1313
apt-get autoclean && rm -rf /var/lib/apt/lists/* && \
14-
pip install -r requirements.txt
14+
pip install -r requirements.txt && \
15+
pip install pymysql pysqlite3
1516

1617
CMD ["/bin/bash", "-c", "python main.py"]

0 commit comments

Comments
 (0)