From a9787f6743045cea1f177d984fb455d0d93e03ed Mon Sep 17 00:00:00 2001 From: "Christopher C. Wells" Date: Tue, 9 Jun 2020 07:11:25 -0700 Subject: [PATCH] Move default `DATABASES` config to babybuddy.settings.base --- babybuddy/settings/base.py | 17 +++++++++++++++-- babybuddy/settings/development.py | 15 ++++----------- babybuddy/settings/travis.py | 11 ----------- 3 files changed, 19 insertions(+), 24 deletions(-) diff --git a/babybuddy/settings/base.py b/babybuddy/settings/base.py index 6acc0b85..fafcca22 100644 --- a/babybuddy/settings/base.py +++ b/babybuddy/settings/base.py @@ -95,6 +95,17 @@ TEMPLATES = [ ] +# Database +# https://docs.djangoproject.com/en/3.0/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + # Cache # https://docs.djangoproject.com/en/3.0/topics/cache/ @@ -224,8 +235,10 @@ IMPORT_EXPORT_IMPORT_PERMISSION_CODE = 'add' IMPORT_EXPORT_EXPORT_PERMISSION_CODE = 'change' IMPORT_EXPORT_USE_TRANSACTIONS = True -# Rolling session refreshes -# How often to refresh the session +# Session configuration +# Used by RollingSessionMiddleware to determine how often to reset the session. +# See https://docs.djangoproject.com/en/3.0/topics/http/sessions/ + ROLLING_SESSION_REFRESH = 86400 # Baby Buddy configuration diff --git a/babybuddy/settings/development.py b/babybuddy/settings/development.py index d13b9eb4..fc65840e 100644 --- a/babybuddy/settings/development.py +++ b/babybuddy/settings/development.py @@ -7,17 +7,6 @@ SECRET_KEY = 'CHANGE ME' DEBUG = True -# Database -# https://docs.djangoproject.com/en/3.0/ref/settings/#databases - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), - } -} - - # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.0/howto/static-files/ # @@ -36,4 +25,8 @@ REST_FRAMEWORK['DEFAULT_RENDERER_CLASSES'] = ( 'rest_framework.renderers.BrowsableAPIRenderer', ) +# Session configuration +# Used by RollingSessionMiddleware to determine how often to reset the session. +# See https://docs.djangoproject.com/en/3.0/topics/http/sessions/ + ROLLING_SESSION_REFRESH = 1 diff --git a/babybuddy/settings/travis.py b/babybuddy/settings/travis.py index b7850624..09f97059 100644 --- a/babybuddy/settings/travis.py +++ b/babybuddy/settings/travis.py @@ -7,14 +7,3 @@ SECRET_KEY = 'TRAVISCIWHYNOT' # https://docs.djangoproject.com/en/3.0/howto/static-files/ STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage' - - -# Database -# https://docs.djangoproject.com/en/3.0/ref/settings/#databases - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), - } -}