From 247c0845e04c2a2224cabd3eef297a6b3eb4f5d3 Mon Sep 17 00:00:00 2001 From: simon Date: Mon, 25 Oct 2021 13:40:09 +0700 Subject: [PATCH] put db on persistend volume --- tubearchivist/config/settings.py | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/tubearchivist/config/settings.py b/tubearchivist/config/settings.py index acbc61f..465e73f 100644 --- a/tubearchivist/config/settings.py +++ b/tubearchivist/config/settings.py @@ -10,9 +10,11 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.2/ref/settings/ """ -from os import environ +from os import environ, path from pathlib import Path +from home.src.config import AppConfig + # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -78,10 +80,12 @@ WSGI_APPLICATION = "config.wsgi.application" # Database # https://docs.djangoproject.com/en/3.2/ref/settings/#databases +CACHE_DIR = AppConfig().config["application"]["cache_dir"] +DB_PATH = path.join(CACHE_DIR, "db.sqlite3") DATABASES = { "default": { "ENGINE": "django.db.backends.sqlite3", - "NAME": BASE_DIR / "db.sqlite3", + "NAME": DB_PATH, } } @@ -109,13 +113,9 @@ AUTH_PASSWORD_VALIDATORS = [ # https://docs.djangoproject.com/en/3.2/topics/i18n/ LANGUAGE_CODE = "en-us" - TIME_ZONE = "UTC" - USE_I18N = True - USE_L10N = True - USE_TZ = True @@ -123,19 +123,8 @@ USE_TZ = True # https://docs.djangoproject.com/en/3.2/howto/static-files/ STATIC_URL = "/static/" - -# STATICFILES_DIRS = [ -# str(BASE_DIR.joinpath('static')), -# '/cache/' -# ] - -# STATIC_URL = '/static/' STATICFILES_DIRS = (str(BASE_DIR.joinpath("static")),) -# MEDIA_ROOT = str(BASE_DIR.joinpath('media')) -# MEDIA_URL = '/media/' - STATIC_ROOT = str(BASE_DIR.joinpath("staticfiles")) - STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" # Default primary key field type