Secure connection between django and mysql

We have Django application and we are configuring ssl in the DATABASES settings in settings.py.

settings.py

DATABASES['default']['ENGINE'] = 'django.db.backends.mysql'
DATABASES['default']['NAME'] = 'database'
DATABASES['default']['HOST'] = "v2_host"
DATABASES['default']['USER'] = "v2_user"
DATABASES['default']['PASSWORD'] = "password"
DATABASES['default']['CONN_MAX_AGE'] = 180
DATABASES['default']['OPTIONS'] = {'init_command': 'SET SESSION wait_timeout=300',
                                     'ssl': {'cert': "/home/myuser/certpath",
                                             'key': "/home/myuser/keypath",
                                             }
                                     }

We are able to connect the database using this. Db team recently enforce secure/encrypted connection from client. When they enforced, we are start getting error Connections using insecure transport are prohibited while --require_secure_transport=ON.

We though, passing ssl is secure connection. But still we are getting error. What we have to pass to make sure connection between Django and mysql are secure?

Leave a Comment