Restoroo/core/modules/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
439 B
Python

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