Esempio n. 1
0
from typing import Optional
from vaas.configuration.loader import YamlConfigLoader


env = environ.Env()


def serialize(value: any) -> str:
    if type(value) in (dict, list, tuple):
        return json.dumps(value)
    return str(value)


config_loader = YamlConfigLoader(['/configuration'])
if config_loader.determine_config_file('config.yaml'):
    # Here we create environments variables from configuration repository and ensure that we have uppercase naming
    os.environ.update({k.upper(): serialize(v) for k, v in config_loader.get_config_tree('config.yaml').items()})

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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env.str('SECRET_KEY', default='notproductionsecret')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env.bool('DEBUG', default=False)
TEMPLATE_DEBUG = env.bool('TEMPLATE_DEBUG', default=False)

# SECURITY WARNING: don't run with debug turned on in production!
ALLOWED_HOSTS = env.json('ALLOWED_HOSTS', default=[])
Esempio n. 2
0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import

import os
from django.conf import global_settings
from vaas.configuration.loader import YamlConfigLoader

BASE_DIR = os.path.dirname(os.path.dirname(__file__))
current_dir = os.path.abspath(os.path.dirname(__file__))
config_loader = YamlConfigLoader()

if not config_loader.determine_config_file('db_config.yml'):
    raise EnvironmentError('Cannot find db_config file')

DATABASES = config_loader.get_config_tree('db_config.yml')

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'pwm_&@a%yd8+7mqf9=*l56+y!@sb7ab==g942j7++gnr9l2%*d'

# SECURITY WARNING: don't run with debug turned on in production!
ALLOWED_HOSTS = []

MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'

# Application definition
INSTALLED_APPS = (
    'django_nose',
    'vaas.adminext',
    'django_admin_bootstrapped',
    'django.contrib.admin',
    'django.contrib.auth',
Esempio n. 3
0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import

import os
from django.conf import global_settings
from vaas.configuration.loader import YamlConfigLoader


BASE_DIR = os.path.dirname(os.path.dirname(__file__))
current_dir = os.path.abspath(os.path.dirname(__file__))
config_loader = YamlConfigLoader()

if not config_loader.determine_config_file('db_config.yml'):
    raise EnvironmentError('Cannot find db_config file')

DATABASES = config_loader.get_config_tree('db_config.yml')

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'pwm_&@a%yd8+7mqf9=*l56+y!@sb7ab==g942j7++gnr9l2%*d'

# SECURITY WARNING: don't run with debug turned on in production!
ALLOWED_HOSTS = []

MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'

# Application definition
INSTALLED_APPS = (
    'django_nose',
    'vaas.adminext',
    'django_admin_bootstrapped',
    'django.contrib.admin',