Merge branch 'master' into task/3709/faq_tos_cms_template

This commit is contained in:
M.Ravi 2017-08-21 18:01:28 +02:00
commit 6339442bfe
15 changed files with 614 additions and 244 deletions

View file

@ -10,6 +10,9 @@ from django.utils.translation import ugettext_lazy as _
# dotenv
import dotenv
import logging
logger = logging.getLogger(__name__)
def gettext(s):
@ -25,6 +28,21 @@ def bool_env(val):
return True if os.environ.get(val, False) == 'True' else False
def int_env(val, default_value=0):
"""Replaces string based environment values with Python integers
Return default_value if val is not set or cannot be parsed, otherwise
returns the python integer equal to the passed val
"""
return_value = default_value
try:
return_value = int(os.environ.get(val))
except Exception as e:
logger.error("Encountered exception trying to get env value for {}\nException details: {}".format(
val, str(e)))
return return_value
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PROJECT_DIR = os.path.abspath(
@ -120,7 +138,8 @@ INSTALLED_APPS = (
'datacenterlight.templatetags',
'alplora',
'rest_framework',
'opennebula_api'
'opennebula_api',
'django_celery_results',
)
MIDDLEWARE_CLASSES = (
@ -526,6 +545,15 @@ GOOGLE_ANALYTICS_PROPERTY_IDS = {
'dynamicweb-staging.ungleich.ch': 'staging'
}
# CELERY Settings
CELERY_BROKER_URL = env('CELERY_BROKER_URL')
CELERY_RESULT_BACKEND = env('CELERY_RESULT_BACKEND')
CELERY_ACCEPT_CONTENT = ['application/json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TIMEZONE = 'Europe/Zurich'
CELERY_MAX_RETRIES = int_env('CELERY_MAX_RETRIES', 5)
ENABLE_DEBUG_LOGGING = bool_env('ENABLE_DEBUG_LOGGING')
if ENABLE_DEBUG_LOGGING: