From e8e7be76182c1319eaf3560c737d06583c852091 Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Fri, 28 Jul 2017 12:05:14 +0200 Subject: [PATCH 1/2] Updated base.py to check if ENABLE_LOGGING is True and in that case enable the logger to write DEBUG level logs to a file debug.log in project's root directory --- dynamicweb/settings/base.py | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index bd6e30e3..1f04502f 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -199,13 +199,11 @@ DATABASES = { } } - AUTHENTICATION_BACKENDS = ( 'guardian.backends.ObjectPermissionBackend', 'django.contrib.auth.backends.ModelBackend', ) - # Internationalization # https://docs.djangoproject.com/en/1.7/topics/i18n/ @@ -464,7 +462,6 @@ META_USE_SITES = True PARLER_LANGUAGES = {1: ({'code': 'en-us'}, {'code': 'de'},)} AUTH_USER_MODEL = 'membership.CustomUser' - # PAYMENT STRIPE_DESCRIPTION_ON_PAYMENT = "Payment for ungleich GmbH services" @@ -481,7 +478,6 @@ STRIPE_API_PUBLIC_KEY = env('STRIPE_API_PUBLIC_KEY') ANONYMOUS_USER_NAME = 'anonymous@ungleich.ch' GUARDIAN_GET_INIT_ANONYMOUS_USER = 'membership.models.get_anonymous_user_instance' - ############################################# # configurations for opennebula-integration # ############################################# @@ -508,7 +504,6 @@ OPENNEBULA_PORT = env('OPENNEBULA_PORT') # default value is /RPC2 OPENNEBULA_ENDPOINT = env('OPENNEBULA_ENDPOINT') - # dcl email configurations DCL_TEXT = env('DCL_TEXT') DCL_SUPPORT_FROM_ADDRESS = env('DCL_SUPPORT_FROM_ADDRESS') @@ -526,9 +521,31 @@ GOOGLE_ANALYTICS_PROPERTY_IDS = { 'dynamicweb-staging.ungleich.ch': 'staging' } +ENABLE_LOGGING = bool_env('ENABLE_LOGGING') + +if ENABLE_LOGGING: + LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'handlers': { + 'file': { + 'level': 'DEBUG', + 'class': 'logging.FileHandler', + 'filename': "{PROJECT_DIR}/debug.log".format(PROJECT_DIR=PROJECT_DIR), + }, + }, + 'loggers': { + 'django': { + 'handlers': ['file'], + 'level': 'DEBUG', + 'propagate': True, + }, + }, + } + DEBUG = bool_env('DEBUG') if DEBUG: - from .local import * # flake8: noqa + from .local import * # flake8: noqa else: - from .prod import * # flake8: noqa + from .prod import * # flake8: noqa From d565294119418076b3c3010986c41356342c6e07 Mon Sep 17 00:00:00 2001 From: Pcoder Date: Sat, 29 Jul 2017 02:02:40 +0530 Subject: [PATCH 2/2] Update base.py Renamed `ENABLE_LOGGING` to `ENABLE_DEBUG_LOGGING` --- dynamicweb/settings/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index 1f04502f..278d08fc 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -521,9 +521,9 @@ GOOGLE_ANALYTICS_PROPERTY_IDS = { 'dynamicweb-staging.ungleich.ch': 'staging' } -ENABLE_LOGGING = bool_env('ENABLE_LOGGING') +ENABLE_DEBUG_LOGGING = bool_env('ENABLE_DEBUG_LOGGING') -if ENABLE_LOGGING: +if ENABLE_DEBUG_LOGGING: LOGGING = { 'version': 1, 'disable_existing_loggers': False,