制定完了基础逻辑框架,下一步就是完善基本逻辑
This commit is contained in:
3
windows/command/help.py
Normal file
3
windows/command/help.py
Normal file
@@ -0,0 +1,3 @@
|
||||
print("dir", "{:8}选择你需要存放数据库的位置".format(" "))
|
||||
print("list", "{:7}查看你需要存放数据库的位置".format(" "))
|
||||
print("init", "{:7}初始化数据库配置".format(" "))
|
||||
17
windows/command/init.py
Normal file
17
windows/command/init.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# 初始化命令脚本
|
||||
import sqlite3
|
||||
import os
|
||||
import sys
|
||||
|
||||
# 初始化生成路径
|
||||
# 确定当前路径
|
||||
dir_path = os.path.dirname(os.path.abspath(__file__))
|
||||
# 确定sqlite数据库初始位置
|
||||
db_path = os.path.dirname(os.path.dirname(dir_path))
|
||||
|
||||
# 建立初始化db文件夹存放数据库
|
||||
os.mkdir(f'{db_path}\\db')
|
||||
|
||||
print(db_path)
|
||||
# 建立sqlite数据库
|
||||
conn = sqlite3.connect(f'{db_path}\\db\\admin.db')
|
||||
10
windows/command/select_sqlite_dir.py
Normal file
10
windows/command/select_sqlite_dir.py
Normal file
@@ -0,0 +1,10 @@
|
||||
import os
|
||||
import sys
|
||||
# 导入当前目录下的packages包到环境变量
|
||||
# 获取当前位置绝对路径
|
||||
dir_path = (os.path.dirname(os.path.abspath(__file__)))
|
||||
sys.path.append(os.path.join(dir_path, '../../'))
|
||||
from packages import python_tcp_to_sqlite as tts
|
||||
|
||||
# 选择你需要存放数据库的位置
|
||||
tts.select_sqlite_dir()
|
||||
Reference in New Issue
Block a user