expephalon/core/modules/urls.py

19 lines
683 B
Python

import importlib
from django.conf import settings
from django.urls import path
URLPATTERNS = []
APIPATTERNS = []
for module in settings.EXPEPHALON_MODULES:
try:
mou = importlib.import_module(f"{module}.urls")
if "ADMIN_URLS" in mou.__dict__.keys():
for url, action, name in mou.ADMIN_URLS:
URLPATTERNS.append(path(f'admin/modules/{module}/{url}', action, name=f"{module}_{name}"))
if "API_URLS" in mou.__dict__.keys():
for url, action, name in mou.API_URLS:
URLPATTERNS.append(path(f"api/modules/{module}/{url}", action, name=f"api_{module}_{name}"))
except ModuleNotFoundError:
pass