diff options
| author | Hasan Ramezani <hasan.r67@gmail.com> | 2020-12-23 23:39:43 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-01-20 17:30:37 +0100 |
| commit | dcb3ad3319cad5c270a1856fd5f355e37cf9d474 (patch) | |
| tree | 919ded9b849cb0a4ae66052c030f5bfb2e980d1a /docs/ref | |
| parent | f054468cac325e8d8fa4d5934b939b93242a3730 (diff) | |
Fixed #32292 -- Added support for connection by service name to PostgreSQL.
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 ------------------------------------- |
