diff --git a/locallibrary/settings.py b/locallibrary/settings.py index e9d136c6..93b53a00 100644 --- a/locallibrary/settings.py +++ b/locallibrary/settings.py @@ -20,10 +20,9 @@ # See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'django-insecure-&psk#na5l=p3q8_a+-$4w1f^lt3lx1c@d*p4x$ymm_rn7pwb87' - +# SECRET_KEY = 'django-insecure-&psk#na5l=p3q8_a+-$4w1f^lt3lx1c@d*p4x$ymm_rn7pwb87' import os -SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', 'cg#p$g+j9tax!#a3cup@1$8obt2_+&k3q+pmu)5%asj6yjpkag') +SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', 'django-insecure-&psk#na5l=p3q8_a+-$4w1f^lt3lx1c@d*p4x$ymm_rn7pwb87') # SECURITY WARNING: don't run with debug turned on in production! #DEBUG = True @@ -45,7 +44,7 @@ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', - # Add our new application + # Add our new application 'catalog.apps.CatalogConfig', #This object was created for us in /catalog/apps.py ] @@ -134,9 +133,12 @@ # Update database configuration from $DATABASE_URL environment variable (if defined) import dj_database_url -db_from_env = dj_database_url.config(conn_max_age=500) -DATABASES['default'].update(db_from_env) +if 'DATABASE_URL' in os.environ: + DATABASES['default'] = dj_database_url.config( + conn_max_age=500, + conn_health_checks=True, + ) # Static files (CSS, JavaScript, Images) diff --git a/requirements.txt b/requirements.txt index 0aab9837..3d733a39 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ -dj-database-url==0.5.0 Django==4.2.3 -gunicorn==20.1.0 -psycopg2-binary==2.9.3 +dj-database-url==2.0.0 +gunicorn==21.2.3 +psycopg2-binary==2.9.6 wheel==0.38.1 whitenoise==6.5.0