Archived
更改包路径
This commit is contained in:
8 files changed
+33
-34
No files matched your search
+1
-1
@@ -10,6 +10,6 @@ dist/
|
||||
*.tar
|
||||
*.gz
|
||||
*.db
|
||||
!/db/count.db
|
||||
!/bin/db/count.db
|
||||
*.log
|
||||
*.log.*
|
||||
@@ -20,7 +20,7 @@ from bin.utils.error import ErrorProcess
|
||||
from bin.utils.view import view_template
|
||||
from bin.utils.logger import logger
|
||||
from bin.utils.packlog import make_targz
|
||||
from db.sqlite import fetch_data
|
||||
from bin.db.sqlite import fetch_data
|
||||
|
||||
app = Flask(__name__, static_url_path='')
|
||||
app.config['JSON_SORT_KEYS'] = False # 设置JSON消息不根据字母顺序重新排序
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
#!/usr/bin/env python3
|
||||
# -- coding:utf-8 --
|
||||
# @Author: markushammered@gmail.com
|
||||
# @Development Tool: PyCharm
|
||||
# @Create Time: 2022/2/4
|
||||
# @File Name: __init__.py.py
|
||||
|
||||
|
||||
import os
|
||||
from bin.utils.logger import logger
|
||||
|
||||
if not os.path.exists('./db/count.db'):
|
||||
logger.error('未检测到用户计数数据库')
|
||||
import sqlite3
|
||||
conn = sqlite3.connect('./db/count.db', check_same_thread=False)
|
||||
cursor = conn.cursor()
|
||||
cursor.execute('create table ReqCount (name text primary key, times int)')
|
||||
conn.commit()
|
||||
cursor.close()
|
||||
conn.close()
|
||||
logger.info('已在./db 目录下创建了count.db数据库')
|
||||
#!/usr/bin/env python3
|
||||
# -- coding:utf-8 --
|
||||
# @Author: markushammered@gmail.com
|
||||
# @Development Tool: PyCharm
|
||||
# @Create Time: 2022/2/4
|
||||
# @File Name: __init__.py.py
|
||||
|
||||
|
||||
import os
|
||||
from bin.utils.logger import logger
|
||||
|
||||
if not os.path.exists('./db/count.db'):
|
||||
logger.error('未检测到用户计数数据库')
|
||||
import sqlite3
|
||||
conn = sqlite3.connect('./bin/db/count.db', check_same_thread=False)
|
||||
cursor = conn.cursor()
|
||||
cursor.execute('create table ReqCount (name text primary key, times int)')
|
||||
conn.commit()
|
||||
cursor.close()
|
||||
conn.close()
|
||||
logger.info('已在./db 目录下创建了count.db数据库')
|
||||
File renamed without changes.
@@ -15,7 +15,7 @@ def insert_data(name: str) -> None:
|
||||
:param name:
|
||||
:return:
|
||||
"""
|
||||
conn = sqlite3.connect('./db/count.db', check_same_thread=False)
|
||||
conn = sqlite3.connect('./bin/db/count.db', check_same_thread=False)
|
||||
cursor = conn.cursor()
|
||||
try:
|
||||
cursor.execute('insert into ReqCount values(?, ?)', (name, 1))
|
||||
@@ -31,7 +31,7 @@ def fetch_data(name: str) -> int:
|
||||
:param name:
|
||||
:return:
|
||||
"""
|
||||
conn = sqlite3.connect('./db/count.db', check_same_thread=False)
|
||||
conn = sqlite3.connect('./bin/db/count.db', check_same_thread=False)
|
||||
cursor = conn.cursor()
|
||||
try:
|
||||
cursor.execute('select * from ReqCount')
|
||||
@@ -64,7 +64,7 @@ def update_data(name: str, times: int) -> None:
|
||||
:param times:
|
||||
:return:
|
||||
"""
|
||||
conn = sqlite3.connect('./db/count.db', check_same_thread=False)
|
||||
conn = sqlite3.connect('./bin/db/count.db', check_same_thread=False)
|
||||
cursor = conn.cursor()
|
||||
try:
|
||||
times += 1
|
||||
@@ -80,7 +80,7 @@ def fetch_table() -> list:
|
||||
返回已有主题列表
|
||||
:return:
|
||||
"""
|
||||
conn_temp = sqlite3.connect('./db/style.db', check_same_thread=False)
|
||||
conn_temp = sqlite3.connect('./bin/db/style.db', check_same_thread=False)
|
||||
cursor_temp = conn_temp.cursor()
|
||||
try:
|
||||
lst = []
|
||||
@@ -99,7 +99,7 @@ def fetch_style_data(style: str) -> list[dict[str, Any]]:
|
||||
:param style:
|
||||
:return:
|
||||
"""
|
||||
conn = sqlite3.connect('./db/style.db', check_same_thread=False)
|
||||
conn = sqlite3.connect('./bin/db/style.db', check_same_thread=False)
|
||||
cursor = conn.cursor()
|
||||
try:
|
||||
cursor.execute('select * from %(style_name)s' % {'style_name': style})
|
||||
@@ -14,11 +14,11 @@ if __name__ == '__main__':
|
||||
yes_or_no = input('该操作会将数据库初始化输入y继续:')
|
||||
if yes_or_no == 'y':
|
||||
try:
|
||||
os.remove('../../db/count.db')
|
||||
os.remove('../db/count.db')
|
||||
except PermissionError:
|
||||
print('有其他程序正在使用此数据库无法删除')
|
||||
sys.exit(-1)
|
||||
conn = sqlite3.connect('../../db/count.db')
|
||||
conn = sqlite3.connect('../db/count.db')
|
||||
cursor = conn.cursor()
|
||||
cursor.execute('create table ReqCount (name text primary key, times integer )')
|
||||
sys.exit(0)
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
from typing import Optional
|
||||
from flask import jsonify
|
||||
from flask import Response
|
||||
from db.sqlite import (update_data, fetch_table)
|
||||
from bin.db import (update_data, fetch_table)
|
||||
|
||||
|
||||
class ErrorProcess:
|
||||
|
||||
+2
-3
@@ -6,10 +6,9 @@
|
||||
# @File Name: view.py
|
||||
|
||||
|
||||
import sqlite3
|
||||
from flask import render_template
|
||||
from db.sqlite import fetch_style_data
|
||||
from db.sqlite import fetch_table
|
||||
from bin.db import fetch_style_data
|
||||
from bin.db import fetch_table
|
||||
|
||||
|
||||
def view_template(style: str, length: int, name: str, count: str) -> str or tuple[bool, str]:
|
||||
|
||||
Reference in New Issue
Block a user