It defaults to a tcp connection even when the unix_domain_socket_path is specified as the redis_host parameter is not None since it sets itself to localhost due to the line.
For domain socket connection to work, either the host parameter should be explicitly set to None or the following lines in sessions.py could be changed,
if settings.SESSION_REDIS_URL is not None:
self.connection_type = 'redis_url'
elif settings.SESSION_REDIS_HOST is not None:
self.connection_type = 'redis_host'
elif settings.SESSION_REDIS_UNIX_DOMAIN_SOCKET_PATH is not None:
self.connection_type = 'redis_unix_url'
to,
if settings.SESSION_REDIS_URL is not None:
self.connection_type = 'redis_url'
elif settings.SESSION_REDIS_UNIX_DOMAIN_SOCKET_PATH is not None:
self.connection_type = 'redis_unix_url'
elif settings.SESSION_REDIS_HOST is not None:
self.connection_type = 'redis_host'
This way, we check for the unix_domain_socket_path before the redis_host.
It defaults to a tcp connection even when the unix_domain_socket_path is specified as the redis_host parameter is not None since it sets itself to localhost due to the line.
SESSION_REDIS_HOST = SESSION_REDIS.get('host', 'localhost')
For domain socket connection to work, either the host parameter should be explicitly set to None or the following lines in sessions.py could be changed,
to,
This way, we check for the unix_domain_socket_path before the redis_host.