Archived
更新了新的视图
This commit is contained in:
11 files changed
+82
-27
No files matched your search
@@ -6,5 +6,7 @@
|
||||
# @File Name: __init__.py.py
|
||||
|
||||
__all__ = [
|
||||
'view'
|
||||
'view',
|
||||
'password',
|
||||
'logger'
|
||||
]
|
||||
@@ -12,7 +12,12 @@ from colorlog import ColoredFormatter
|
||||
|
||||
|
||||
class CreateLogger:
|
||||
"""创建日志器"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""
|
||||
初始化类
|
||||
"""
|
||||
self.date_format = '%H:%M:%S'
|
||||
self.info_format_console = '%(log_color)s[%(asctime)s] |%(filename)-12s[%(lineno)s] |%(levelname)-8s |%(message)s'
|
||||
self.info_format_file = '[%(asctime)s] |%(filename)s[%(funcName)sline:%(lineno)d] |%(levelname)-8s |%(message)s'
|
||||
@@ -29,6 +34,10 @@ class CreateLogger:
|
||||
datefmt=self.date_format)
|
||||
|
||||
def get_logger(self) -> logging.Logger:
|
||||
"""
|
||||
设置日志器
|
||||
:return:
|
||||
"""
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.setLevel(logging.DEBUG)
|
||||
console_logger = logging.StreamHandler() # 输出到终端
|
||||
@@ -44,4 +53,9 @@ class CreateLogger:
|
||||
|
||||
@staticmethod
|
||||
def init_app(app):
|
||||
"""
|
||||
虚假的init_app静态方法
|
||||
:param app:
|
||||
:return:
|
||||
"""
|
||||
pass
|
||||
+11
-1
@@ -12,7 +12,7 @@ from flask import render_template
|
||||
from typing import Tuple
|
||||
|
||||
|
||||
def view(theme: str, length: int, name: str, count: str ) -> str or Tuple[bool, str]:
|
||||
def view_(theme: str, length: int, name: str, count: str) -> str or Tuple[bool, str]:
|
||||
"""
|
||||
渲染模板
|
||||
:param theme:
|
||||
@@ -77,3 +77,13 @@ def view(theme: str, length: int, name: str, count: str ) -> str or Tuple[bool,
|
||||
address=request.remote_addr,
|
||||
general_height=general_height,
|
||||
general_width=general_width)
|
||||
|
||||
|
||||
def listing_(data: list):
|
||||
"""
|
||||
展示数据库内所有的数据
|
||||
:param data:
|
||||
:return:
|
||||
"""
|
||||
return render_template('list.html',
|
||||
data=data)
|
||||
Reference in New Issue
Block a user