# -*- coding: utf-8 -*- # pymode:lint_ignore=E501 """ Common settings and globals. """ from os import environ def get_env_setting(setting): """ Get the environment setting or return exception. :param str setting: name of an environment setting :raises ImproperlyConfigured: if the environment setting is not defined :return: environment setting value :rtype: str """ try: return environ[setting] except KeyError: error_msg = "Set the %s env variable" % setting raise AssertionError(error_msg) ########## CELERY CONFIGURATION CELERY_TIMEZONE = "Europe/Berlin" CELERY_ENABLE_UTC = True CELERY_RESULT_PERSISTENT = True CELERY_TASK_RESULT_EXPIRES = None CELERY_ROUTES = ("gvacommon.celeryrouters.GvaRouter",) CELERY_ACCEPT_CONTENT = ["json"] CELERY_TASK_SERIALIZER = "json" CELERY_RESULT_SERIALIZER = "json" CELERY_RESULT_BACKEND = get_env_setting("GVAWEB_RESULTS_REDIS_URL") CELERY_BROKER_URL = get_env_setting("GVAWEB_BROKER_URL") ########## END CELERY CONFIGURATION ########## GVAWEB CONFIGURATION GVAWEB_NGINX_SITES_AVAILABLE = get_env_setting("GVAWEB_NGINX_SITES_AVAILABLE") GVAWEB_NGINX_SITES_ENABLED = get_env_setting("GVAWEB_NGINX_SITES_ENABLED") GVAWEB_WWWUSER_MOUNT = get_env_setting("GVAWEB_WWWUSER_MOUNT") ########## END GVAWEB CONFIGURATION