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
This commit is contained in:
parent
53fc982837
commit
e8e7be7618
1 changed files with 24 additions and 7 deletions
|
@ -199,13 +199,11 @@ DATABASES = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AUTHENTICATION_BACKENDS = (
|
AUTHENTICATION_BACKENDS = (
|
||||||
'guardian.backends.ObjectPermissionBackend',
|
'guardian.backends.ObjectPermissionBackend',
|
||||||
'django.contrib.auth.backends.ModelBackend',
|
'django.contrib.auth.backends.ModelBackend',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Internationalization
|
# Internationalization
|
||||||
# https://docs.djangoproject.com/en/1.7/topics/i18n/
|
# 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'},)}
|
PARLER_LANGUAGES = {1: ({'code': 'en-us'}, {'code': 'de'},)}
|
||||||
AUTH_USER_MODEL = 'membership.CustomUser'
|
AUTH_USER_MODEL = 'membership.CustomUser'
|
||||||
|
|
||||||
|
|
||||||
# PAYMENT
|
# PAYMENT
|
||||||
|
|
||||||
STRIPE_DESCRIPTION_ON_PAYMENT = "Payment for ungleich GmbH services"
|
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'
|
ANONYMOUS_USER_NAME = 'anonymous@ungleich.ch'
|
||||||
GUARDIAN_GET_INIT_ANONYMOUS_USER = 'membership.models.get_anonymous_user_instance'
|
GUARDIAN_GET_INIT_ANONYMOUS_USER = 'membership.models.get_anonymous_user_instance'
|
||||||
|
|
||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
# configurations for opennebula-integration #
|
# configurations for opennebula-integration #
|
||||||
#############################################
|
#############################################
|
||||||
|
@ -508,7 +504,6 @@ OPENNEBULA_PORT = env('OPENNEBULA_PORT')
|
||||||
# default value is /RPC2
|
# default value is /RPC2
|
||||||
OPENNEBULA_ENDPOINT = env('OPENNEBULA_ENDPOINT')
|
OPENNEBULA_ENDPOINT = env('OPENNEBULA_ENDPOINT')
|
||||||
|
|
||||||
|
|
||||||
# dcl email configurations
|
# dcl email configurations
|
||||||
DCL_TEXT = env('DCL_TEXT')
|
DCL_TEXT = env('DCL_TEXT')
|
||||||
DCL_SUPPORT_FROM_ADDRESS = env('DCL_SUPPORT_FROM_ADDRESS')
|
DCL_SUPPORT_FROM_ADDRESS = env('DCL_SUPPORT_FROM_ADDRESS')
|
||||||
|
@ -526,6 +521,28 @@ GOOGLE_ANALYTICS_PROPERTY_IDS = {
|
||||||
'dynamicweb-staging.ungleich.ch': 'staging'
|
'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')
|
DEBUG = bool_env('DEBUG')
|
||||||
|
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
|
|
Loading…
Reference in a new issue