通过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不检查
}
}
}
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-database-pool-0.0.3.tar.gz.
File metadata
- Download URL: django-database-pool-0.0.3.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/44.1.1 requests-toolbelt/0.8.0 tqdm/4.23.3 CPython/2.7.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cfa10e2523a0215be8a1c7a4c905f1818021a511ea232bf336fa2965901937f
|
|
| MD5 |
86aa2c633d32d036db09051d1c15e21f
|
|
| BLAKE2b-256 |
ea957098930af417ca54c5c0e8cc8ca9fbe98cc013c9633fad3947c603baf10e
|