diff --git a/app.py b/app.py index f7eaa96..4fdf829 100644 --- a/app.py +++ b/app.py @@ -128,9 +128,10 @@ def index(): if __name__ == '__main__': # app.run(threaded=True) - print('服务器已在http://127.0.0.1:5000 运行. \n除了请求次数和名称会被保存到本地数据库中其余任何数据都不会被保存') + print('服务器已在http://127.0.0.1:5000 运行') try: server = pywsgi.WSGIServer(('0.0.0.0', 5000), app) server.serve_forever() except OSError: print('5000 端口被占用') + diff --git a/bin/core/length.py b/bin/core/length.py index 3012b95..92f78db 100644 --- a/bin/core/length.py +++ b/bin/core/length.py @@ -6,7 +6,7 @@ # @File Name: length.py -def make_html(length: int, svg_width: int = 45, svg_height: int = 70) -> None: +def make_html(length: int, svg_width: int = 45, svg_height: int = 50) -> None: """ 生成html :param svg_height: @@ -17,7 +17,7 @@ def make_html(length: int, svg_width: int = 45, svg_height: int = 70) -> None: html_head = """ -{{ title }} +Flask Counter - {{ title }} \n""" svg_tag = """ \n""" html_feet = """""" diff --git a/bin/tests/init_db.py b/bin/tests/init_db.py new file mode 100644 index 0000000..b0be68a --- /dev/null +++ b/bin/tests/init_db.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 +# -- coding:utf-8 -- +# @Author: markushammered@gmail.com +# @Development Tool: PyCharm +# @Create Time: 2022/2/5 +# @File Name: init_db.py + +import os +import sqlite3 +import sys + +if __name__ == '__main__': + while True: + yes_or_no = input('该操作会将数据库初始化输入y继续:') + if yes_or_no == 'y': + os.remove('../../db/data.db') + conn = sqlite3.connect('../../db/data.db') + cursor = conn.cursor() + cursor.execute('create table ReqCount (name text primary key, times integer )') + sys.exit(0) + elif yes_or_no == 'n': + print('已取消') + sys.exit(0) + else: + print('请输入y继续或n退出') + continue diff --git a/db/data.db b/db/data.db index 4af75fe..43373c3 100644 Binary files a/db/data.db and b/db/data.db differ diff --git a/templates/index.html b/templates/index.html index 2eafa0f..85d51ae 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,13 +1,12 @@ - -{{ title }} + +Flask Counter - {{ title }} - - - - - - - - + + + + + + + \ No newline at end of file