service.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:intellead-classification 作者: intellead 项目源码 文件源码
def get_connection():
    try:
        conn = psycopg2.connect(host=os.getenv('DATABASE_HOST', 'intellead-classification-postgresql'), database=os.getenv('DATABASE_NAME', 'postgres'),
                                user=os.getenv('DATABASE_USER', 'postgres'), password=os.getenv('DATABASE_PASSWORD', 'postgres'))
    except (Exception, psycopg2.DatabaseError) as error:
        print(error)
    finally:
        if conn is not None:
            return conn
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号