Skip to content

Commit 670421c

Browse files
committed
updated postgres ++
1 parent f5e0259 commit 670421c

File tree

3 files changed

+4
-17
lines changed

3 files changed

+4
-17
lines changed

samples/django-channels-redis/app/django_defang/settings.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,6 @@
1616
import urllib.parse
1717

1818

19-
# print redis and postgres urls
20-
print('@@@@@@@ DEBUG @@@@@@@')
21-
print(f'redis: {os.getenv("REDIS_URL", None)}')
22-
print(f'postgres: {os.getenv("POSTGRES_URL", None)}')
23-
print(f'postgres_password: {os.getenv("POSTGRES_PASSWORD", None)}')
24-
postgres_url = os.getenv("POSTGRES_URL", None)
25-
postgres_password = os.getenv("POSTGRES_PASSWORD", None)
26-
fixed_postgres_url = postgres_url.replace("password", postgres_password) if postgres_url and postgres_password else postgres_url
27-
print(f'fixed_postgres_url: {fixed_postgres_url}')
28-
print('@@@@@@@ DEBUG @@@@@@@')
29-
30-
3119
# Build paths inside the project like this: BASE_DIR / 'subdir'.
3220
BASE_DIR = Path(__file__).resolve().parent.parent
3321

@@ -99,7 +87,7 @@
9987
DATABASES = {
10088
# default is a postrgres database load from environment variable POSTGRES_URL
10189
"default": dj_database_url.config(
102-
default=fixed_postgres_url
90+
default=os.getenv("POSTGRES_URL", None)
10391
)
10492
}
10593

samples/django-channels-redis/compose.dev.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ services:
1313
depends_on:
1414
- redis_service
1515
- postgres_service
16-
command: python manage.py runserver 0.0.0.0:8000
16+
command: sh -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000"
1717

1818
redis_service:
1919
extends:

samples/django-channels-redis/compose.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ services:
1313
mode: ingress
1414
environment:
1515
REDIS_URL: redis://redis_service:6379
16-
POSTGRES_URL: postgres://postgres:password@postgres_service:5432/postgres
17-
POSTGRES_PASSWORD: testtest
16+
POSTGRES_URL:
1817
healthcheck:
1918
# wget or curl required for healthchecks on services with a published port
2019
# this gets parsed by Defang and provided to the load balancers as well
@@ -34,4 +33,4 @@ services:
3433
- mode: host
3534
target: 5432
3635
environment:
37-
POSTGRES_PASSWORD: testtest
36+
POSTGRES_PASSWORD:

0 commit comments

Comments
 (0)