diff --git a/AttendanceV2/settings.py b/AttendanceV2/settings.py index f6df1cf..93431c9 100644 --- a/AttendanceV2/settings.py +++ b/AttendanceV2/settings.py @@ -9,7 +9,8 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/5.1/ref/settings/ """ - +import os +import dj_database_url from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. @@ -80,7 +81,9 @@ "NAME": BASE_DIR / "db.sqlite3", } } - +# Update database info if it's in $DATABASE_URL environment variable +db_from_env = dj_database_url.config(conn_max_age=500) +DATABASES["default"].update(db_from_env) # Password validation # https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators diff --git a/requirements.txt b/requirements.txt index bf8b68f..f48a6e4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,6 @@ Django~=5.1.4 autoflake~=2.3.1 black~=24.10.0 -gspread==6.1.2 \ No newline at end of file +dj-database-url==2.1.0 +gspread==6.1.2 +psycopg2~=2.9.10 \ No newline at end of file