Merge pull request #4421 from Andrew-Chen-Wang/patch-7

Change psycopg2 to psycopg3
This commit is contained in:
Jelmer 2023-06-29 08:58:29 +02:00 committed by GitHub
commit 4ef180edb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -20,14 +20,14 @@ python << END
import sys import sys
import time import time
import psycopg2 import psycopg
suggest_unrecoverable_after = 30 suggest_unrecoverable_after = 30
start = time.time() start = time.time()
while True: while True:
try: try:
psycopg2.connect( psycopg.connect(
dbname="${POSTGRES_DB}", dbname="${POSTGRES_DB}",
user="${POSTGRES_USER}", user="${POSTGRES_USER}",
password="${POSTGRES_PASSWORD}", password="${POSTGRES_PASSWORD}",
@ -35,7 +35,7 @@ while True:
port="${POSTGRES_PORT}", port="${POSTGRES_PORT}",
) )
break break
except psycopg2.OperationalError as error: except psycopg.OperationalError as error:
sys.stderr.write("Waiting for PostgreSQL to become available...\n") sys.stderr.write("Waiting for PostgreSQL to become available...\n")
if time.time() - start > suggest_unrecoverable_after: if time.time() - start > suggest_unrecoverable_after:

View File

@ -3,9 +3,9 @@
Werkzeug[watchdog]==2.3.6 # https://github.com/pallets/werkzeug Werkzeug[watchdog]==2.3.6 # https://github.com/pallets/werkzeug
ipdb==0.13.13 # https://github.com/gotcha/ipdb ipdb==0.13.13 # https://github.com/gotcha/ipdb
{%- if cookiecutter.use_docker == 'y' %} {%- 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 %} {%- else %}
psycopg2-binary==2.9.6 # https://github.com/psycopg/psycopg2 psycopg[binary]==3.1.9 # https://github.com/psycopg/psycopg
{%- endif %} {%- endif %}
{%- if cookiecutter.use_async == 'y' or cookiecutter.use_celery == 'y' %} {%- if cookiecutter.use_async == 'y' or cookiecutter.use_celery == 'y' %}
watchfiles==0.19.0 # https://github.com/samuelcolvin/watchfiles watchfiles==0.19.0 # https://github.com/samuelcolvin/watchfiles

View File

@ -3,7 +3,7 @@
-r base.txt -r base.txt
gunicorn==20.1.0 # https://github.com/benoitc/gunicorn 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' %} {%- if cookiecutter.use_whitenoise == 'n' %}
Collectfast==2.2.0 # https://github.com/antonagestam/collectfast Collectfast==2.2.0 # https://github.com/antonagestam/collectfast
{%- endif %} {%- endif %}