当前位置: 首页 > news >正文

潍坊网站制作如何布置网站

潍坊网站制作,如何布置网站,11电影网,WordPress云笔记监测数据采集物联网应用开发步骤(4) Sqlite3数据库读写操作开发、异常信息统一处理类开发 本章节需要调用sqlite3及mysql-connector 安装sqlite3 Pip3 install sqlite3 安装mysql-connector pip3 install mysql-connector 验证是否安装成功#xff0c;python中运行下列…监测数据采集物联网应用开发步骤(4) Sqlite3数据库读写操作开发、异常信息统一处理类开发 本章节需要调用sqlite3及mysql-connector 安装sqlite3 Pip3 install sqlite3 安装mysql-connector pip3 install mysql-connector 验证是否安装成功python中运行下列代码无异常则安装成功 import sqlite3 import mysql.connector在项目开发过程中各类异常信息try...except处理该处理类将try ...except异常信息统一处理并日志文件输出便于快速定位错误信息及代码位置 异常信息日志打印格式 yyyy-MM-dd H:mm:ss异常的类名该类中调用出错的函数名其他异常信息 参考如下图 创建异常信息统一处理类com.zxy.z_debug.py 调用方式参考 from com.zxy.z_debug import z_debug class ClassName(z_debug):com.zxy.z_debug.py类 #! python3 # -*- coding: utf-8 -Created on 2023年08月28日 author: zxyong 13738196011 import inspect,datetime from com.zxy.adminlog.UsAdmin_Log import UsAdmin_Log from com.zxy.common import Com_Para#监测数据采集物联网应用--异常信息统一处理 class z_debug(object):def __init__(self):passdef debug_in(self,inputMsg):excStr datetime.datetime.now().strftime(%Y-%m-%d %H:%M:%S)str(self)self.__class__.__name__.inspect.stack()[1][3]inputMsguL UsAdmin_Log(Com_Para.ApplicationPath, excStr)uL.SaveFileDaySub(exception)print(excStr)def debug_info(self):excStr datetime.datetime.now().strftime(%Y-%m-%d %H:%M:%S)str(self)self.__class__.__name__.inspect.stack()[1][3]uL UsAdmin_Log(Com_Para.ApplicationPath, excStr)uL.SaveFileDaySub(exception_debug)return excStr在多个线程中使用访问SQLite数据库为避免多个线程之间的竞争。需要添加数据库线程锁机制以确保线程安全若使用mysql数据库无需数据库线程锁机制。 在com.zxy.common.Com_Para.py中添加如下内容 #数据库线程锁机制 Dblock1 threading.Lock() Dblock2 threading.Lock() Dblock3 threading.Lock() Dblock4 threading.Lock() #静态数据库配置文件路径 ACTIONPATH dbconfig.properties driverClassName url username password #是否桌面数据库 0:Mysql 1:sqlite3 IL_DB 1 #数据库连接池初始数量 1:Sqlite3 incrementalConnections 2 #数据库连接池最大数量 maxConnections 10 port -1 UserDebug 0创建静态配置库数据库配置文件读写类com.zxy.common.DbConfigSelf.py #! python3 # -*- coding: utf-8 -Created on 2023年08月28日 author: zxyong 13738196011 import configparser from com.zxy.common import Com_Para from com.zxy.z_debug import z_debug#监测数据采集物联网应用--静态配置库数据库配置文件读写 class DbConfigSelf(z_debug):def __init__(self):passstaticmethoddef GetDbConfigSelfNew():temPath Com_Para.ApplicationPath Com_Para.zxyPath Com_Para.ACTIONPATHtemProp configparser.ConfigParser()try:temProp.read(temPath)Com_Para.driverClassName temProp.get(DB, dataSource.driverClassName) if Com_Para.driverClassName org.sqlite.JDBC :Com_Para.incrementalConnections 1Com_Para.maxConnections 1Com_Para.IL_DB 1temStrRem temProp.get(DB,dataSource.url).replace(,Com_Para.ApplicationPath Com_Para.zxyPath)Com_Para.url temStrRemelse:Com_Para.url temProp.get(DB, dataSource.url)Com_Para.username temProp.get(DB, dataSource.username)Com_Para.password temProp.get(DB, dataSource.password)Com_Para.port temProp.getint(DB, server.port)Com_Para.UserDebug temProp.getint(DB, userDebug)except Exception as e:print(GetDbConfigSelfNew:repr(e)str(e.__traceback__.tb_lineno))finally:Pass 创建静态配置库数据库配置文件dbconfig.properties 配置文件内容 [DB] dataSource.driverClassNameorg.sqlite.JDBC dataSource.urlcenter_data.db dataSource.username dataSource.passwordserver.port9000 userDebug0监测数据采集物联网应用开发步骤(5.2)
http://www.hkea.cn/news/14363936/

相关文章:

  • 哪个网站查食品建设好有女人和马做网站吗
  • 做行程好的网站广州住建网站
  • 旅游网站开发与建设论文南京建设工程招聘信息网站
  • 学习网站建设要报班吗php的网站模板
  • 嘉兴cms建站模板上海做网站定制
  • 淮安做网站.哪家网络公司好?公司用wordpress建站用花钱
  • 一个网站多个域名备案如何做一个网页设计方案
  • 网站招聘顾问做啥的网站建设哪种品牌好
  • 建网站域名注册wordpress网站防护
  • 佛山网站建设网站建设襄阳网站建设找下拉哥科技
  • php企业网站后台管理系统免费域名注册方式
  • 电商网站欣赏查询网站到期时间
  • 注册账号自建网站商丘做建设网站的公司
  • 自然景观网站模板程序员知识网站需要多少钱
  • 网站价值排行计算机程序设计网站开发
  • 5款免费的网站管理系统电商付费推广有哪些
  • 能够做外贸的网站有哪些问题西安网页搭建
  • 物联网网站设计网站后台如何添加关键词
  • 怎么做可以访问网站连接加密梅林多丽工业区做网站
  • 欧美 手机网站模板下载 迅雷下载 迅雷下载地址住房和城乡建设岗位评定网站
  • 江苏省城市建设信用手册网站上海网站优化上
  • 网站建设的 几点企业网站建设基本流程
  • 360浏览器打不开90设计网站南宁有名的网络公司
  • 从入门到精通网站建设怎么注册自己的小程序
  • 雅安市网站建设最新注册的公司在哪里可以查询
  • 黄村专业网站建设公司网站难做
  • 国外网建站php网站开发有什么优点
  • 做外贸一般总浏览的网站新乡手机网站建设
  • 简单网站模板下载石家庄百度推广排名
  • 土建找工作去哪个网站安徽网站seo公司