This commit is contained in:
@@ -5,8 +5,7 @@ from importlib.resources import files as resource_files
|
||||
from django.conf import settings
|
||||
from django.urls import re_path, include
|
||||
|
||||
DJANGO_MAIN_MODULE = 'main'
|
||||
MODULE_CONFIG_FILE_NAME = 'module_config.json'
|
||||
from ..constants import DJANGO_MAIN_MODULE, MODULES_CONFIG_FILE_NAME
|
||||
|
||||
|
||||
class ModuleConfigError(Exception):
|
||||
@@ -64,6 +63,12 @@ class ModuleMeta:
|
||||
url_conf = self._package_name + '.urls'
|
||||
return re_path(url_pattern, include(url_conf, self.url_namespace))
|
||||
|
||||
@property
|
||||
def root_url_name(self):
|
||||
if self.url_namespace:
|
||||
return '{}:{}'.format(self.url_namespace, self._root_url_name)
|
||||
return self._root_url_name
|
||||
|
||||
def _load_from_package(self):
|
||||
package_name = self._package_name
|
||||
json_text = resource_files(package_name).joinpath(self._json_file).read_bytes()
|
||||
@@ -97,7 +102,7 @@ class ModuleConfig:
|
||||
if config_file_path is None:
|
||||
if django_base_dir is None:
|
||||
django_base_dir = settings.BASE_DIR
|
||||
config_file_path = os.path.join(django_base_dir, DJANGO_MAIN_MODULE, MODULE_CONFIG_FILE_NAME)
|
||||
config_file_path = os.path.join(django_base_dir, DJANGO_MAIN_MODULE, MODULES_CONFIG_FILE_NAME)
|
||||
self._config_file_path = config_file_path
|
||||
|
||||
self._modules = {}
|
||||
|
||||
Reference in New Issue
Block a user