You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
import os
from pydantic import BaseSettings
class Settings ( BaseSettings ) :
NAME : str = " DG16-D "
DEBUG : bool = False
RELOAD : bool = False
ENV : str = " dev "
SERVER_HOST : str = " 0.0.0.0 "
SERVER_POST : int = 8099
LOGS_DIR : str = " logs "
RESOURCE_PATH : str = " resource "
TEMP_PATH : str = " temp "
DB_DIR : str = " db "
TEM : list = [ 40 , 60 , 80 , 100 ] # 计算温度点
BASE_PATH : str = os . path . dirname ( os . path . dirname ( ( os . path . abspath ( __file__ ) ) ) )
'''
数据库的配置
'''
SQLALCHEMY_DATABASE_URI : str = ' sqlite:///app/db/Data.db '
'''
分页信息配置
'''
PAGE_SIZE : int = 10
PAGE_MIN_SIZE : int = 6
PAGE_DEFAULT_OFFSET : int = 1
'''
modbus-rtu连接参数
'''
PORT : str = " COM1 " # 串口号
BAUDRATE : int = 9600 # 波特率
BYTESIZE : int = 8 # 数据位
STOPBITS : int = 1 # 停止位
TIMEOUT : int = 5 # 超时时间
MACHINE : int = 1 # 设备 1沒有没有摄像头, 2有摄像头
settings = Settings ( )
for i in [ settings . LOGS_DIR , settings . TEMP_PATH , settings . RESOURCE_PATH , settings . DB_DIR ] :
dir = os . path . join ( settings . BASE_PATH , i )
if not os . path . exists ( dir ) :
os . mkdir ( dir )