读取配置文件转成json连接数据库
import psycopg2
import json
def load_db_config():
with open('../conf/db0.conf', "r") as f:
config_json = json.loads(f.read())
return config_json
config_json = load_db_config()
def handle_conn():
conn = psycopg2.connect(**config_json)
return conn