forked from reactive-python/reactpy-django
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
31 lines (23 loc) · 982 Bytes
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
from typing import Dict
from django.conf import settings
from django.core.cache import DEFAULT_CACHE_ALIAS
from idom.core.proto import ComponentConstructor
os.environ["IDOM_DEBUG_MODE"] = str(int(settings.DEBUG))
IDOM_REGISTERED_COMPONENTS: Dict[str, ComponentConstructor] = {}
IDOM_BASE_URL = getattr(settings, "IDOM_BASE_URL", "_idom/")
IDOM_WEBSOCKET_URL = IDOM_BASE_URL + "websocket/"
IDOM_WEB_MODULES_URL = IDOM_BASE_URL + "web_module/"
IDOM_WS_MAX_RECONNECT_DELAY = getattr(settings, "IDOM_WS_MAX_RECONNECT_DELAY", 604800)
_CACHES = getattr(settings, "CACHES", {})
if _CACHES:
if "idom_web_modules" in getattr(settings, "CACHES", {}):
IDOM_WEB_MODULE_CACHE = "idom_web_modules"
else:
IDOM_WEB_MODULE_CACHE = DEFAULT_CACHE_ALIAS
else:
IDOM_WEB_MODULE_CACHE = None
# the LRU cache size for the route serving IDOM_WEB_MODULES_DIR files
IDOM_WEB_MODULE_LRU_CACHE_SIZE = getattr(
settings, "IDOM_WEB_MODULE_LRU_CACHE_SIZE", None
)