X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=multivimbroker%2Fmultivimbroker%2Fsettings.py;h=d5cd466bbbab0147081344fc2184d24174c786f6;hb=0e39e0363e1008d4f162b247747d8bbecffd7ae1;hp=faea32d745f84fb194316ee56018015d9723c548;hpb=67430600410e312c2db5a6a7709da8e45a5245fa;p=multicloud%2Fframework.git diff --git a/multivimbroker/multivimbroker/settings.py b/multivimbroker/multivimbroker/settings.py index faea32d..d5cd466 100644 --- a/multivimbroker/multivimbroker/settings.py +++ b/multivimbroker/multivimbroker/settings.py @@ -1,4 +1,5 @@ # Copyright (c) 2017 Wind River Systems, Inc. +# Copyright (c) 2017-2018 VMware, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,6 +12,9 @@ import os import sys +from logging import config +from onaplogging import monkey +monkey.patch_all() # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -22,9 +26,9 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SECRET_KEY = '3o-wney!99y)^h3v)0$j16l9=fdjxcb+a8g+q3tfbahcnu2b0o' # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +# DEBUG = True -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ['*'] # Application definition @@ -47,6 +51,7 @@ MIDDLEWARE_CLASSES = [ 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'multivimbroker.middleware.LogContextMiddleware', ] ROOT_URLCONF = 'multivimbroker.urls' @@ -66,12 +71,6 @@ REST_FRAMEWORK = { ) } -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), - } -} # CACHE_BACKEND = 'redis_cache.cache://%s@%s:%s' % # (REDIS_PASSWD, REDIS_HOST, REDIS_PORT) @@ -83,46 +82,15 @@ TIME_ZONE = 'UTC' STATIC_URL = '/static/' -LOGGING = { - 'version': 1, - 'disable_existing_loggers': True, - 'formatters': { - 'standard': { - 'format': '%(asctime)s:[%(name)s]:[%(filename)s]-[%(lineno)d] \ - [%(levelname)s]:%(message)s', - }, - }, - 'filters': { - }, - 'handlers': { - 'multivimbroker_handler': { - 'level': 'DEBUG', - 'class': 'logging.handlers.RotatingFileHandler', - 'filename': os.path.join(BASE_DIR, - 'logs/runtime_multivimbroker.log'), - 'formatter': 'standard', - 'maxBytes': 1024 * 1024 * 50, - 'backupCount': 5, - }, - }, - - 'loggers': { - 'multivimbroker': { - 'handlers': ['multivimbroker_handler'], - 'level': 'DEBUG', - 'propagate': False - }, - } -} + +LOGGING_CONFIG = None +# yaml configuration of logging +LOGGING_FILE = os.path.join(BASE_DIR, 'multivimbroker/pub/config/log.yml') +config.yamlConfig(filepath=LOGGING_FILE, watchDog=True) + if 'test' in sys.argv: from multivimbroker.pub.config import config - config.REG_TO_MSB_WHEN_START = False - DATABASES = {} - DATABASES['default'] = { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': ':memory:', - } REST_FRAMEWORK = {} import platform