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.
44 lines
1.6 KiB
44 lines
1.6 KiB
# -*- coding: utf-8 -*-
|
|
"""
|
|
models.db
|
|
~~~~~~~~~~~~~~
|
|
|
|
数据库连接配置.
|
|
|
|
:copyright: 云南新八达科技有限公司.
|
|
:author: 李进才.
|
|
"""
|
|
from flask import Flask
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
import urllib
|
|
|
|
app = Flask(__name__)
|
|
# 数据库配置
|
|
# 本地
|
|
# params = urllib.parse.quote_plus("DRIVER={SQL Server};SERVER=127.0.0.1;DATABASE=lisdb;UID=sa;PWD=")
|
|
# 元谋中医院
|
|
# params = urllib.parse.quote_plus("DRIVER={SQL Server};SERVER=127.0.0.1;DATABASE=lisdb;UID=sa;PWD=sixflag")
|
|
# 武定中医院
|
|
# params = urllib.parse.quote_plus("DRIVER={SQL Server};SERVER=127.0.0.1;DATABASE=lisdb;UID=sa;PWD=000626")
|
|
# 阿里云
|
|
params = urllib.parse.quote_plus("DRIVER={ODBC Driver 17 for SQL Server};SERVER=192.168.12.188;DATABASE=lisdb;UID"
|
|
"=sa;PWD=000626")
|
|
app.config["SQLALCHEMY_DATABASE_URI"] = "mssql+pyodbc:///?odbc_connect=%s" % params
|
|
|
|
# app.config["SQLALCHEMY_DATABASE_URI"] = 'mssql+pyodbc://ruby/RMS?driver=SQL Server?Trusted_Connection=yes'
|
|
# 数据库配置
|
|
# app.config["SQLALCHEMY_DATABASE_URI"] = "mysql+pymysql://root:toor@localhost/lis_reagent"
|
|
# 查询时会显示原始SQL语句
|
|
app.config['SQLALCHEMY_ECHO'] = True
|
|
|
|
app.config['TEMPLATE_FOLDER'] = 'template'
|
|
|
|
app.config['FILE_FOLDER'] = 'file'
|
|
|
|
app.config['SQLALCHEMY_ENGINE_OPTIONS'] = {'pool_size': 10,
|
|
'pool_recycle': 120,
|
|
'pool_pre_ping': True
|
|
}
|
|
|
|
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
|
|
db = SQLAlchemy(app)
|
|
|