Add a MySQL connection pool for django using gevent
Project description
django-mysql-geventpool
Mysql Connection Pooling backend for Django 2.0+ using gevent, only supports Python 3.4 or newer. It works with gunicorn async worker via gevent.
This implimentation is based on django-db-geventpool(https://github.com/jneight/django-db-geventpool).
install
pip install django-mysql-geventpool
Settings
Add the 'django_mysql_geventpool' modules to the INSTALLED_APPS like this:
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_mysql_geventpool',
# ...other installed applications...
)
Add MAX_CONNS to OPTIONS to set the maximun number of connections allowed to database (default=4)
DATABASES = {
'default': {
'ENGINE': 'django_mysql_geventpool.backends.mysql',
'NAME': 'dbname',
'USER': 'dbuser',
'PASSWORD': 'dbpassword',
'HOST': 'dbhost',
'PORT': 'dbport',
'OPTIONS': {
'MAX_CONNS': 20,
'MAX_LIFETIME': 5 * 60 # connection lifetime in seconds, and if set 0, unlimited persistent connections if usable. default is 0.
}
}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for django-mysql-geventpool-0.2.6.dev1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 230cbe7f8af9cf72c6e24bf0ab88cd6137e4b1cfaf695c039a93535bfa555cea |
|
MD5 | 18bc18a8dadd38bb68f86e224f00938b |
|
BLAKE2b-256 | b194f0d38ca667ad2e2e615338575453b459a7d9bc7fc277d7f1966b66395789 |