Beispiel #1
0
import os
import tzlocal

from csss.logger_setup import initialize_logger

if 'BASE_DIR' in os.environ:
    BASE_DIR = os.environ['BASE_DIR']
else:
    BASE_DIR = os.path.dirname(os.path.dirname(__file__))

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
if 'LOG_LOCATION' in os.environ:
    LOG_LOCATION = os.environ['LOG_LOCATION']
else:
    LOG_LOCATION = f"{BASE_DIR}/website_logs/python_logs"
logger = initialize_logger(LOG_LOCATION)

logger.info(f'[settings.py] BASE_DIR set to {BASE_DIR}')
logger.info(f'[settings.py] LOG_LOCATION set to {LOG_LOCATION}')

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
if 'WEBSITE_SECRET_KEY' not in os.environ:
    logger.error("[settings.py] NO WEBSITE_SECRET_KEY was detected")
    exit(1)

SECRET_KEY = os.environ['WEBSITE_SECRET_KEY']

# SECURITY WARNING: don't run with debug turned on in production!
Beispiel #2
0
import environ
import os
from csss.logger_setup import initialize_logger

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
logger = initialize_logger()

if 'BASE_DIR' in os.environ:
    BASE_DIR = os.environ['BASE_DIR']
else:
    BASE_DIR = os.path.dirname(os.path.dirname(__file__))
logger.info(f'[settings.py] BASE_DIR set to {BASE_DIR}')

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
if 'WEBSITE_SECRET_KEY' not in os.environ:
    logger.error("[settings.py] NO WEBSITE_SECRET_KEY was detected")
    exit(1)

SECRET_KEY = os.environ['WEBSITE_SECRET_KEY']

# SECURITY WARNING: don't run with debug turned on in production!
if "DEBUG" not in os.environ:
    logger.error("[settings.py] DEBUG was not detected")
    exit(1)
DEBUG = os.environ['DEBUG'] == "true"
logger.info(f'[settings.py] DEBUG set to {DEBUG}')

if "HOST_ADDRESS" not in os.environ: