Skip to content

Commit 299338f

Browse files
Fix incompatible postgres database driver
1 parent 7800543 commit 299338f

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ WORKDIR /app
77
RUN apt-get update \
88
&& apt-get install -y --no-install-recommends \
99
build-essential \
10-
libpq-dev \
1110
default-libmysqlclient-dev \
1211
pkg-config \
12+
gcc \
13+
python3-dev \
1314
&& rm -rf /var/lib/apt/lists/*
1415

1516
# Install Python dependencies
@@ -25,7 +26,6 @@ WORKDIR /app
2526
RUN apt-get update \
2627
&& apt-get install -y --no-install-recommends \
2728
gosu \
28-
libpq5 \
2929
default-mysql-client \
3030
&& rm -rf /var/lib/apt/lists/*
3131

config.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,16 @@ def get_engine_options(cls):
2323
}
2424
}
2525
elif 'postgresql' in database_url.lower() or 'postgres' in database_url.lower():
26-
# PostgreSQL-specific settings
26+
# PostgreSQL-specific settings (psycopg3 compatible)
2727
return {
2828
'pool_size': 10,
2929
'max_overflow': 20,
3030
'pool_timeout': 30,
3131
'pool_recycle': 3600,
32-
'pool_pre_ping': True
32+
'pool_pre_ping': True,
33+
'connect_args': {
34+
'connect_timeout': 10
35+
}
3336
}
3437
elif 'mysql' in database_url.lower() or 'mariadb' in database_url.lower():
3538
# MySQL/MariaDB-specific settings

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ Werkzeug==3.1.3
1111
requests==2.32.5
1212

1313
# Database drivers
14-
psycopg2-binary==2.9.9
14+
psycopg[binary,pool]==3.2.3
1515
PyMySQL==1.1.1

0 commit comments

Comments
 (0)