Skip to content

Commit 0fcb912

Browse files
11 - Connect Django & Proxy Database
1 parent b2d8ab4 commit 0fcb912

File tree

5 files changed

+59
-4
lines changed

5 files changed

+59
-4
lines changed

Pipfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ verify_ssl = true
88
[packages]
99
django = "*"
1010
gunicorn = "*"
11+
psycopg2-binary = "*"
1112

1213
[requires]
1314
python_version = "3.8"

Pipfile.lock

Lines changed: 37 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/migrate_proxy_db.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
DJANGO_SETTINGS_MODULE=serverless_django.settings.local_proxy python manage.py migrate
2+
3+
DJANGO_SETTINGS_MODULE=serverless_django.settings.production python manage.py migrate

serverless_django/settings/local.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,15 @@
1414
'ENGINE': 'django.db.backends.sqlite3',
1515
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
1616
}
17-
}
17+
}
18+
19+
# DATABASES = {
20+
# 'default': {
21+
# 'ENGINE': 'django.db.backends.postgresql',
22+
# 'NAME': "local",
23+
# 'USER': "dblocaluser",
24+
# "PASSWORD": "<your_pw>",
25+
# "HOST": '127.0.0.1',
26+
# "PORT": 5432,
27+
# }
28+
# }

serverless_django/settings/local_proxy.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
# Database
1111
DATABASES = {
1212
'default': {
13-
'ENGINE': 'django.db.backends.sqlite3',
14-
'NAME': os.path.join(BASE_DIR, 'db_proxy.sqlite3'),
13+
'ENGINE': 'django.db.backends.postgresql',
14+
'NAME': "local",
15+
'USER': "dblocaluser",
16+
"PASSWORD": "<your_pw>",
17+
"HOST": '127.0.0.1',
18+
"PORT": 6543,
1519
}
1620
}

0 commit comments

Comments
 (0)