美文网首页数据库
常见数据库连接设置

常见数据库连接设置

作者: 陆_志东 | 来源:发表于2018-09-05 10:08 被阅读0次

    mysql:

        mysql_config = {
            "host": "",
            "port": 3306,
            "user": "",
            "password": "",
            "db": "",
            "cursorclass": DictCursor,  # 字典游标
            "autocommit": True,
            "charset": "utf8"
        }
    

    redis:

        CONFIG_REDIS_YQ_NEW = {
            "host": "",
            "port": ,
            "auth": "",
            "index": ,
            "encoding": "utf-8",
            "decode_responses": True,  # 返回的时候解码
            "target_max_memory": 3896,
            "max_connections": 1  # 最大连接数
        }
    

    mongodb:

    MONGO_CFG_USER = {
        "write_host": "",  # (master)
        "read_host": "",  # (slave)
        "username": "",
        "password": "",
        "db": "",
    }
    

    elasticsearch:

    from elasticsearch import Elasticsearch
    es_client = Elasticsearch(hosts="ip:port")
    

    相关文章

      网友评论

        本文标题:常见数据库连接设置

        本文链接:https://www.haomeiwen.com/subject/jzwowftx.html