Coder Social home page Coder Social logo

django-db-pool's Introduction

通过DBUtils库实现Django数据库连接池,目前支持mysql、postgresql 数据库.

下面的配置参考:

DATABASES = {
   'default':{
        'ENGINE': 'djdbpool.db.backends.mysql',
        "HOST": "127.0.0.1",
        "NAME": "test_db",
        "PASSWORD": "",
        "USER": "django",
        "PORT": 3306,
        'OPTIONS': {'charset': 'utf8mb4'},
        'POOL': {  # 更多的配置请参考DBUtils的配置
           'minsize': 5, # 初始化时,连接池中至少创建的空闲的链接,0表示不创建,不填默认为5
           'maxsize': 10,  # 连接池中最多闲置的链接,0不限制,不填默认为0
           'maxconnections': 60, # 连接池允许的最大连接数,0表示不限制连接数, 默认为0
           'blocking': True, # 连接池中如果没有可用连接后,是否阻塞等待。True:等待;False:不等待然后报错, 默认False
           'ping':0  # 检查服务是否可用 1检查0不检查
        }
    }
}

django-db-pool's People

Contributors

caowenbin avatar yhweb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.