[Python] Django + DigitalOcean Managed PostgreS: “remaining connection slots are reserved for...

Discussão em 'Python' iniciado por Stack, Abril 28, 2025.

  1. Stack

    Stack Membro Participativo

    I’m trying to configure Django to use a connection pool against a DigitalOcean Managed PostgreSQL instance, but keep running into this error:

    OperationalError: connection failed: connection to server at "xxxxxxxxxxxx", port yyyy failed: FATAL:
    remaining connection slots are reserved for roles with the SUPERUSER attribute

    My DATABASES setting looks like this (Django 5.2+):

    DATABASES = {
    'default': {
    'ENGINE': 'django.db.backends.postgresql',
    'NAME': database_name,
    'USER': database_user,
    'PASSWORD': database_password,
    'HOST': database_host,
    'PORT': database_port,
    "OPTIONS": {
    'sslmode': sslmode,
    'pool': {
    'min_size': 5,
    'max_size': 150,
    'timeout': 20,
    },
    }
    }
    }



    Is this the correct way to enable pooling via Django’s built-in OPTIONS['pool'] settings?

    Continue reading...

Compartilhe esta Página