17 lines
439 B
Python
17 lines
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}")
|