Socket
Socket
Sign inDemoInstall

django-mysql-geventpool

Package Overview
Dependencies
0
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    django-mysql-geventpool

Add a MySQL connection pool for django using gevent


Maintainers
1

Readme

django-mysql-geventpool

CircleCI

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.
        }
    }
}

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc