diff --git a/{{cookiecutter.project_slug}}/compose/production/django/entrypoint b/{{cookiecutter.project_slug}}/compose/production/django/entrypoint index 2fbcad95..dd07f2d2 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/entrypoint +++ b/{{cookiecutter.project_slug}}/compose/production/django/entrypoint @@ -20,14 +20,14 @@ python << END import sys import time -import psycopg2 +import psycopg suggest_unrecoverable_after = 30 start = time.time() while True: try: - psycopg2.connect( + psycopg.connect( dbname="${POSTGRES_DB}", user="${POSTGRES_USER}", password="${POSTGRES_PASSWORD}", @@ -35,7 +35,7 @@ while True: port="${POSTGRES_PORT}", ) break - except psycopg2.OperationalError as error: + except psycopg.OperationalError as error: sys.stderr.write("Waiting for PostgreSQL to become available...\n") if time.time() - start > suggest_unrecoverable_after: diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 2b0e954f..0674362f 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -3,9 +3,9 @@ Werkzeug[watchdog]==2.3.6 # https://github.com/pallets/werkzeug ipdb==0.13.13 # https://github.com/gotcha/ipdb {%- if cookiecutter.use_docker == 'y' %} -psycopg2==2.9.6 # https://github.com/psycopg/psycopg2 +psycopg[c]==3.1.9 # https://github.com/psycopg/psycopg {%- else %} -psycopg2-binary==2.9.6 # https://github.com/psycopg/psycopg2 +psycopg[binary]==3.1.9 # https://github.com/psycopg/psycopg {%- endif %} {%- if cookiecutter.use_async == 'y' or cookiecutter.use_celery == 'y' %} watchfiles==0.19.0 # https://github.com/samuelcolvin/watchfiles diff --git a/{{cookiecutter.project_slug}}/requirements/production.txt b/{{cookiecutter.project_slug}}/requirements/production.txt index 36f6e74f..a45ff8e7 100644 --- a/{{cookiecutter.project_slug}}/requirements/production.txt +++ b/{{cookiecutter.project_slug}}/requirements/production.txt @@ -3,7 +3,7 @@ -r base.txt gunicorn==20.1.0 # https://github.com/benoitc/gunicorn -psycopg2==2.9.6 # https://github.com/psycopg/psycopg2 +psycopg[c]==3.1.9 # https://github.com/psycopg/psycopg {%- if cookiecutter.use_whitenoise == 'n' %} Collectfast==2.2.0 # https://github.com/antonagestam/collectfast {%- endif %}