diff options
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/databases.txt | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt index a9edf43c54..b9a82140a0 100644 --- a/docs/ref/databases.txt +++ b/docs/ref/databases.txt @@ -108,11 +108,43 @@ required, though the latest release is recommended. .. _psycopg2: https://www.psycopg.org/ +.. _postgresql-connection-settings: + PostgreSQL connection settings ------------------------------- See :setting:`HOST` for details. +To connect using a service name from the `connection service file`_, you must +specify it in the :setting:`OPTIONS` part of your database configuration in +:setting:`DATABASES`: + +.. code-block:: python + :caption: settings.py + + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql', + 'OPTIONS': {'service': 'my_service'}, + } + } + +.. code-block:: text + :caption: .pg_service.conf + + [my_service] + host=localhost + user=USER + dbname=NAME + password=PASSWORD + port=5432 + +.. _connection service file: https://www.postgresql.org/docs/current/libpq-pgservice.html + +.. versionchanged:: 4.0 + + Support for connecting by a service name was added. + Optimizing PostgreSQL's configuration ------------------------------------- |
