X-Git-Url: https://git.p6c8.net/pcdenotes.git/blobdiff_plain/3fb7b9dea69252f64ee82967dfca97baf1b02df7..f03e7473f19531e0fc59feaabeb96cba438d6a9d:/pcdenotes/settings.py?ds=inline diff --git a/pcdenotes/settings.py b/pcdenotes/settings.py index 7c51c45..88b705d 100644 --- a/pcdenotes/settings.py +++ b/pcdenotes/settings.py @@ -12,20 +12,26 @@ https://docs.djangoproject.com/en/3.2/ref/settings/ from pathlib import Path +from dotenv import load_dotenv, find_dotenv + +import os + # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent +# Load .env file +load_dotenv(BASE_DIR / '.env') # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'django-insecure-(bf$#80p=*wkj(yh$)3oec0nn#46k$8(m#hx4yx8d02kcog3$q' +SECRET_KEY = str(os.getenv('PCDENOTES_SECRET_KEY')) # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +DEBUG = str(os.getenv('PCDENOTES_DEBUG', 'false')).lower() == 'true' -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ['*'] # Application definition @@ -77,8 +83,12 @@ WSGI_APPLICATION = 'pcdenotes.wsgi.application' DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', + 'ENGINE': 'django.db.backends.mysql', + 'NAME': str(os.getenv('PCDENOTES_DB_NAME')), + 'HOST': str(os.getenv('PCDENOTES_DB_HOST')), + 'PORT': int(os.getenv('PCDENOTES_DB_PORT')), + 'USER': str(os.getenv('PCDENOTES_DB_USER')), + 'PASSWORD': str(os.getenv('PCDENOTES_DB_PASSWORD')) } } @@ -120,6 +130,9 @@ USE_TZ = True # https://docs.djangoproject.com/en/3.2/howto/static-files/ STATIC_URL = '/static/' +STATIC_ROOT = BASE_DIR / 'static' + +STATICFILES_DIRS = [BASE_DIR / 'notes/static'] # Default primary key field type # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field @@ -131,4 +144,6 @@ MARKDOWNIFY = { #"STRIP": False, "BLEACH": False } -} \ No newline at end of file +} + +NOTES_PER_PAGE = 5 \ No newline at end of file