コード例 #1
0
ファイル: envs_test.py プロジェクト: mitodl/micromasters
def test_get_string():
    """
    get_string should get the string from the environment variable
    """
    with patch('micromasters.envs.os', environ=FAKE_ENVIRONS):
        for key, value in FAKE_ENVIRONS.items():
            assert get_string(key, 'default') == value
        assert get_string('missing', 'default') == 'default'
        assert get_string('missing', 'default') == 'default'
コード例 #2
0
def test_get_string():
    """
    get_string should get the string from the environment variable
    """
    with patch('micromasters.envs.os', environ=FAKE_ENVIRONS):
        for key, value in FAKE_ENVIRONS.items():
            assert get_string(key, 'default') == value
        assert get_string('missing', 'default') == 'default'
        assert get_string('missing', 'default') == 'default'
コード例 #3
0
ファイル: settings.py プロジェクト: johnfelipe/micromasters
from celery.schedules import crontab
from django.core.exceptions import ImproperlyConfigured
from micromasters.envs import (
    get_any,
    get_bool,
    get_int,
    get_list_of_str,
    get_string,
)

from micromasters.sentry import init_sentry

VERSION = "0.177.1"

# initialize Sentry before doing anything else so we capture any config errors
ENVIRONMENT = get_string('MICROMASTERS_ENVIRONMENT', 'dev')
SENTRY_DSN = get_string("SENTRY_DSN", "")
SENTRY_LOG_LEVEL = get_string("SENTRY_LOG_LEVEL", "ERROR")
init_sentry(
    dsn=SENTRY_DSN, environment=ENVIRONMENT, version=VERSION, log_level=SENTRY_LOG_LEVEL
)

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = get_string(
    'SECRET_KEY',
    '36boam8miiz0c22il@3&gputb=wrqr2plah=0#0a_bknw9(2^r'
コード例 #4
0
ファイル: settings.py プロジェクト: mitodl/micromasters
    get_list_of_str,
    get_string,
)


VERSION = "0.133.1"


BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = get_string(
    'SECRET_KEY',
    '36boam8miiz0c22il@3&gputb=wrqr2plah=0#0a_bknw9(2^r'
)

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = get_bool('DEBUG', False)

if DEBUG:
    # Disabling the protection added in 1.10.3 against a DNS rebinding vulnerability:
    # https://docs.djangoproject.com/en/1.10/releases/1.10.3/#dns-rebinding-vulnerability-when-debug-true
    # Because we never debug against production data, we are not vulnerable
    # to this problem.
    ALLOWED_HOSTS = ['*']
else:
    ALLOWED_HOSTS = get_list_of_str('ALLOWED_HOSTS', [])

SECURE_SSL_REDIRECT = get_bool('MICROMASTERS_SECURE_SSL_REDIRECT', True)