Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 885dd36

Browse files
postgreSQL
1 parent 5079603 commit 885dd36

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed
-75 Bytes
Binary file not shown.

‎leetcodeApi/settings.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from pathlib import Path
1414
from decouple import config
1515
import os
16+
import dj_database_url
1617

1718
# Build paths inside the project like this: BASE_DIR / 'subdir'.
1819
BASE_DIR = Path(__file__).resolve().parent.parent
@@ -86,15 +87,21 @@
8687
# }
8788
# }
8889

90+
# DATABASES = {
91+
# 'default': {
92+
# 'ENGINE': 'django.db.backends.postgresql',
93+
# 'NAME': 'LeetCode',
94+
# 'USER': 'postgres',
95+
# 'PASSWORD': 'postgres',
96+
# 'HOST': '127.0.0.1',
97+
# 'PORT': '5432',
98+
# }
99+
# }
100+
89101
DATABASES = {
90-
'default': {
91-
'ENGINE': 'django.db.backends.postgresql',
92-
'NAME': 'LeetCode',
93-
'USER': 'postgres',
94-
'PASSWORD': 'postgres',
95-
'HOST': '127.0.0.1',
96-
'PORT': '5432',
97-
}
102+
'default': dj_database_url.config(
103+
default=config('DATABASE_URL')
104+
)
98105
}
99106

100107
# Password validation

‎requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ whitenoise
66
psycopg2
77
requests
88
pandas
9-
python-decouple
9+
python-decouple
10+
dj_database_url

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /