Skip to content

Commit 1630d07

Browse files
authored
Merge pull request #1 from shindy-dev/temp
update
2 parents 952b1e0 + 2cdeac2 commit 1630d07

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

docker/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ django==5.2.3
22
psycopg2-binary==2.9.10
33
markdown==3.8.2
44
whitenoise==6.9.0
5+
urllib3==2.5.0

synpageproject/settings.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
import os
1414
from pathlib import Path
15+
from urllib.parse import urlparse, parse_qsl
16+
17+
tmpPostgres = urlparse(os.getenv("DATABASE_URL"))
1518

1619
# Build paths inside the project like this: BASE_DIR / 'subdir'.
1720
BASE_DIR = Path(__file__).resolve().parent.parent
@@ -81,12 +84,13 @@
8184

8285
DATABASES = {
8386
"default": {
84-
"ENGINE": "django.db.backends.postgresql",
85-
"NAME": os.environ.get("DB_NAME", "your_db_name"),
86-
"USER": os.environ.get("DB_USER", "your_db_user"),
87-
"PASSWORD": os.environ.get("DB_PASSWORD", "your_db_password"),
88-
"HOST": os.environ.get("DB_HOST", "your_db_host"),
89-
"PORT": os.environ.get("DB_PORT", "5432"),
87+
'ENGINE': 'django.db.backends.postgresql',
88+
'NAME': tmpPostgres.path.replace('/', ''),
89+
'USER': tmpPostgres.username,
90+
'PASSWORD': tmpPostgres.password,
91+
'HOST': tmpPostgres.hostname,
92+
'PORT': 5432,
93+
'OPTIONS': dict(parse_qsl(tmpPostgres.query)),
9094
},
9195
"sqlite3": {
9296
"ENGINE": "django.db.backends.sqlite3",

0 commit comments

Comments
 (0)