Skip to content

Commit

Permalink
Add settings 4.2 for dj url:
Browse files Browse the repository at this point in the history
  • Loading branch information
hamishwillee committed Jul 31, 2023
1 parent 82dcc41 commit a608553
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
14 changes: 8 additions & 6 deletions locallibrary/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
]

Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit a608553

Please sign in to comment.