17 lines
No EOL
451 B
Python
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}") |