Fixed #33308 -- Added support for psycopg version 3.

Thanks Simon Charette, Tim Graham, and Adam Johnson for reviews.

Co-authored-by: Florian Apolloner <florian@apolloner.eu>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
This commit is contained in:
Daniele Varrazzo 2022-12-01 20:23:43 +01:00 committed by Mariusz Felisiak
parent d44ee518c4
commit 09ffc5c121
42 changed files with 673 additions and 223 deletions

View file

@ -429,14 +429,14 @@ Install Django and set up database
recommended that you create a :doc:`virtual environment
<python:tutorial/venv>` for each project you create.
psycopg2
~~~~~~~~
psycopg
~~~~~~~
The ``psycopg2`` Python module provides the interface between Python and the
PostgreSQL database. ``psycopg2`` can be installed via pip within your Python
The ``psycopg`` Python module provides the interface between Python and the
PostgreSQL database. ``psycopg`` can be installed via pip within your Python
virtual environment::
...\> py -m pip install psycopg2
...\> py -m pip install psycopg
.. rubric:: Footnotes
.. [#] GeoDjango uses the :func:`~ctypes.util.find_library` routine from

View file

@ -7,20 +7,25 @@ into a spatial database. :ref:`geosbuild`, :ref:`proj4` and
:ref:`gdalbuild` should be installed prior to building PostGIS. You
might also need additional libraries, see `PostGIS requirements`_.
The `psycopg2`_ module is required for use as the database adapter when using
GeoDjango with PostGIS.
The `psycopg`_ or `psycopg2`_ module is required for use as the database
adapter when using GeoDjango with PostGIS.
On Debian/Ubuntu, you are advised to install the following packages:
``postgresql-x``, ``postgresql-x-postgis-3``, ``postgresql-server-dev-x``,
and ``python3-psycopg2`` (x matching the PostgreSQL version you want to
and ``python3-psycopg3`` (x matching the PostgreSQL version you want to
install). Alternately, you can `build from source`_. Consult the
platform-specific instructions if you are on :ref:`macos` or :ref:`windows`.
.. _PostGIS: https://postgis.net/
.. _psycopg: https://www.psycopg.org/psycopg3/
.. _psycopg2: https://www.psycopg.org/
.. _PostGIS requirements: https://postgis.net/docs/postgis_installation.html#install_requirements
.. _build from source: https://postgis.net/docs/postgis_installation.html#install_short_version
.. versionchanged:: 4.2
Support for ``psycopg`` 3.1+ was added.
Post-installation
=================