Restoroo/core/templates/discovery.py
Kumi a38d324bdb Initial commit
Custom user model
Preparations for module/template discovery
2022-05-21 17:06:18 +02:00

17 lines
No EOL
451 B
Python

from importlib import import_module
from logging import Logger
from django.conf import settings
logger = Logger("core.templates.discovery")
templates = []
for f in (settings.BASE_DIR / "templates").glob("*"):
if f.is_dir() and f.name.isalnum():
try:
import_module("templates." + f.name)
templates.append(f.name)
except Exception as e:
logger.info(f"Could not import template {f.name}: {e}")