Load multisite urls using json

This commit is contained in:
PCoder 2018-02-20 08:48:19 +01:00
parent 7f6a66bc16
commit 575835aa05

View file

@ -5,6 +5,7 @@ Copyright 2015 ungleich.
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os import os
import json
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
@ -520,13 +521,14 @@ MULTISITE_CMS_URLS = {}
if UNGLEICH_SITE_CONFIGS == "": if UNGLEICH_SITE_CONFIGS == "":
raise Exception("Please define UNGLEICH_SITE_CONFIGS in your .env") raise Exception("Please define UNGLEICH_SITE_CONFIGS in your .env")
else: else:
ungleich_site_config_list = UNGLEICH_SITE_CONFIGS.split(";") try:
for ungliech_site_config in ungleich_site_config_list: configs_dict=json.loads(UNGLEICH_SITE_CONFIGS)
ungliech_site_params = ungliech_site_config.split(":") except ValueError as verr:
if len(ungliech_site_params) <= 1: raise Exception("UNGLEICH_SITE_CONFIGS is not a valid JSON")
raise Exception("Incomplete UNGLEICH_SITE_CONFIGS") else:
else: MULTISITE_CMS_URLS = {
MULTISITE_CMS_URLS[ungliech_site_params[0]] = ungliech_site_params[1] k:v['MULTISITE_CMS_URL'] for (k,v) in configs_dict.items()
}
MULTISITE_CMS_ALIASES = { MULTISITE_CMS_ALIASES = {
} }