Django的DB-API2连接池(适用于postgresql、mysql和sqlite)
项目描述
DB-API2连接池为Django。
描述
是一个使用出色的SQLAlchemy连接池并将其集成到Django中的简单应用程序。所有工作都基于https://github.com/kennethreitz/django-postgrespool/
注意:目前仅在postgresql上进行了测试,但从理论上讲,它应该可以与mysql和sqlite3完美配合。
如何安装
运行python setup.py install进行安装,或将djorm_pool添加到您的Python路径。
您还可以使用以下方式安装: pip install djorm-ext-pool
如何使用它?
非常简单,将djorm_pool添加到您的INSTALLED_APPS设置中
# settings.py
INSTALLED_APPS = (
'djorm_pool',
...
)
您可以在设置“DJORM_POOL_OPTIONS”中添加选项以使用SQLAlchemy连接池。
示例
DJORM_POOL_OPTIONS = {
"pool_size": 20,
"max_overflow": 0,
"recycle": 3600, # the default value
}
此外,还可以通过设置 DJORM_POOL_PESSIMISTIC 来激活悲观连接处理
# With this settings, every checkout of a connection from a pool
# executes an additional query for check the connection state.
DJORM_POOL_PESSIMISTIC = True
项目详情
关闭
djorm-ext-pool-0.8.2.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 1c6d4df714ebfb302d9eef61203d25e2fe40a316fcfa92dec36c2599d40547a6 |
|
MD5 | ed98ec6512817017eb8f8045186c71b8 |
|
BLAKE2b-256 | 8389e5a5ff8c3f1174d885946dc0f03caf0e2e76618a45ea98d2808bda879eb9 |