Skip to main content

django-mysql-geventpool-27

.. image:: https://circleci.com/gh/laurentL/django-mysql-geventpool/tree/master.svg?style=svg :target: https://circleci.com/gh/laurentL/django-mysql-geventpool/tree/master

Mysql Connection Pooling backend for Django > 2.0 using gevent, only supports Python 3.7+ It works with gunicorn async worker via gevent. It implement an loadbalancing simple algo.

Fork from : https://github.com/shunsukeaihara/django-mysql-geventpool

This implimentation is based on django-db-geventpool(https://github.com/jneight/django-db-geventpool).

Installation

.. code-block:: console

pip install django-mysql-geventpool-27

Settings

Add the 'django_mysql_geventpool_27' modules to the INSTALLED_APPS like this:

.. code-block:: python

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django_mysql_geventpool-27',
    # ...other installed applications...

Add MAX_CONNS to OPTIONS to set the maximun number of connections allowed to database (default=4)

.. code-block:: python

DATABASES = {
    'default': {
        'ENGINE': 'django_mysql_geventpool_27.backends.mysql',
        'NAME': 'dbname',
        'USER': 'dbuser',
        'PASSWORD': 'dbpassword',
        'HOST': 'dbhost',
        'PORT': 'dbport',
        'OPTIONS': {
            'MAX_CONNS': 20
        }
    }
}

Load balancing Galera multi master

For each connection, a random choice is operated on the HOST key of the DATABASE setting. For easy provisioning by an orchetrator like puppet/salt/ansible.., you can use this type of setting:

.. note::

All server must listen on the same tcp port.

.. code-block:: python

DATABASES = {
    'default': {
        'ENGINE': 'django_mysql_geventpool_27.backends.mysql',
        'NAME': 'dbname',
        'USER': 'dbuser',
        'PASSWORD': 'dbpassword',
        'HOST': 'server1,server2,serve3',
        'PORT': 'dbport',
        'OPTIONS': {
            'MAX_CONNS': 20
        }
    }
}

Release files for django-mysql-geventpool-27 0.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-mysql-geventpool-27 0.3.4
File Size Uploaded
django-mysql-geventpool-27-0.3.4.tar.gz 9.9 kB Details

Release files / django-mysql-geventpool-27-0.3.4.tar.gz

Download URL django-mysql-geventpool-27-0.3.4.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b8838ac4c6c50265fbe44da9b2daf18f6955a6e6c5b4459c662c2d4e7a6437b4
BLAKE2b-256 checksum
How to use checksums
39e647277bf71a11b861fa91aa779758f3858852945aab3d713e829c4cd6a30b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release history Release notifications | RSS feed

This release

0.3.4 This release

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

2 release files

0.2.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page