X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=lcm%2Fsettings.py;h=f20f363ab6bcd7a824d11052e3d603ad0229349b;hb=7ad91bb2cbcb385183c4dfa71194fabcaf81ec07;hp=e5f680bb161190794dafb4a036b6e7b77787e94c;hpb=71dd1a02940c70bb669f2dbcac2dcfe2e14546e0;p=vfc%2Fnfvo%2Flcm.git diff --git a/lcm/settings.py b/lcm/settings.py index e5f680bb..f20f363a 100644 --- a/lcm/settings.py +++ b/lcm/settings.py @@ -14,6 +14,7 @@ import os import sys +import platform import redisco @@ -48,6 +49,7 @@ INSTALLED_APPS = [ 'django.contrib.staticfiles', 'rest_framework', 'lcm.pub.database', + 'lcm.swagger', 'drf_yasg' ] @@ -70,7 +72,7 @@ TEMPLATES = [ SWAGGER_SETTINGS = { 'LOGIN_URL': '/admin/login', 'LOGOUT_URL': '/admin/logout', - 'DEFAULT_INFO': 'lcm.urls.swagger_info' + 'DEFAULT_INFO': 'lcm.swagger.urls.swagger_info' } MIDDLEWARE_CLASSES = [ @@ -113,6 +115,12 @@ DATABASES = { }, } +# DATABASES = {} +# DATABASES['default'] = { +# 'ENGINE': 'django.db.backends.sqlite3', +# 'NAME': 'D:/etsi-plug-test/db/nfvo', +# } + redisco.connection_setup(host=REDIS_HOST, port=REDIS_PORT, password=REDIS_PASSWD, db=0) # CACHE_BACKEND = 'redis_cache.cache://%s@%s:%s' % (REDIS_PASSWD, REDIS_HOST, REDIS_PORT) @@ -123,46 +131,44 @@ TIME_ZONE = 'UTC' STATIC_URL = '/static/' -STATICFILES_DIRS = [ - os.path.join(BASE_DIR, "static") -] +pub_config.AAI_BASE_URL = "http://%s:%s/aai/v11" % (pub_config.MSB_SERVICE_IP, pub_config.MSB_SERVICE_PORT) +pub_config.SDC_BASE_URL = "http://%s:%s/api" % (pub_config.MSB_SERVICE_IP, pub_config.MSB_SERVICE_PORT) + +if platform.system() == 'Windows' or 'test' in sys.argv: + LOGGING = { + 'version': 1, + 'disable_existing_loggers': True, + 'formatters': { + 'standard': { + 'format': '%(asctime)s:[%(name)s]:[%(filename)s]-[%(lineno)d] [%(levelname)s]:%(message)s', + }, + }, + 'filters': { + }, + 'handlers': { + 'lcm_handler': { + 'level': 'DEBUG', + 'class': 'logging.handlers.RotatingFileHandler', + 'filename': os.path.join(BASE_DIR, 'logs/runtime_lcm.log'), + 'formatter': 'standard', + 'maxBytes': 1024 * 1024 * 50, + 'backupCount': 5, + }, + }, -pub_config.CATALOG_ROOT_PATH = os.path.join(STATICFILES_DIRS[0], "catalog") -pub_config.CATALOG_URL_PATH = "static/catalog" -# -# LOGGING = { -# 'version': 1, -# 'disable_existing_loggers': True, -# 'formatters': { -# 'standard': { -# 'format': '%(asctime)s:[%(name)s]:[%(filename)s]-[%(lineno)d] [%(levelname)s]:%(message)s', -# }, -# }, -# 'filters': { -# }, -# 'handlers': { -# 'lcm_handler': { -# 'level': 'DEBUG', -# 'class': 'logging.handlers.RotatingFileHandler', -# 'filename': os.path.join(BASE_DIR, 'logs/runtime_lcm.log'), -# 'formatter': 'standard', -# 'maxBytes': 1024 * 1024 * 50, -# 'backupCount': 5, -# }, -# }, -# -# 'loggers': { -# 'lcm': { -# 'handlers': ['lcm_handler'], -# 'level': 'DEBUG', -# 'propagate': False -# }, -# } -# } -LOGGING_CONFIG = None -# yaml configuration of logging -LOGGING_FILE = os.path.join(BASE_DIR, 'lcm/log.yml') -log_config.yamlConfig(filepath=LOGGING_FILE, watchDog=True) + 'loggers': { + 'lcm': { + 'handlers': ['lcm_handler'], + 'level': 'DEBUG', + 'propagate': False + }, + } + } +else: + LOGGING_CONFIG = None + # yaml configuration of logging + LOGGING_FILE = os.path.join(BASE_DIR, 'lcm/log.yml') + log_config.yamlConfig(filepath=LOGGING_FILE, watchDog=True) if 'test' in sys.argv: pub_config.REG_TO_MSB_WHEN_START = False @@ -173,10 +179,14 @@ if 'test' in sys.argv: 'NAME': ':memory:', } REST_FRAMEWORK = {} - import platform if platform.system() == 'Linux': TEST_RUNNER = 'xmlrunner.extra.djangotestrunner.XMLTestRunner' TEST_OUTPUT_VERBOSE = True TEST_OUTPUT_DESCRIPTIONS = True TEST_OUTPUT_DIR = 'test-reports' + + import mock + from lcm.pub.utils import idutil + idutil.get_auto_id = mock.Mock() + idutil.get_auto_id.return_value = 1