mirror of
https://github.com/django-components/django-components.git
synced 2025-08-03 13:58:16 +00:00
Handle case with SETTINGS_MODULE not set.
This commit is contained in:
parent
681c540cb7
commit
f5c3f64c86
1 changed files with 9 additions and 7 deletions
|
@ -13,14 +13,16 @@ class Loader(FilesystemLoader):
|
||||||
def get_dirs(self):
|
def get_dirs(self):
|
||||||
component_dir = "components"
|
component_dir = "components"
|
||||||
directories = list(get_app_template_dirs(component_dir))
|
directories = list(get_app_template_dirs(component_dir))
|
||||||
settings_path = Path(*settings.SETTINGS_MODULE.split("."))
|
|
||||||
|
|
||||||
path = (settings_path / ".." / component_dir).resolve()
|
if settings.SETTINGS_MODULE:
|
||||||
if path.is_dir():
|
settings_path = Path(*settings.SETTINGS_MODULE.split("."))
|
||||||
directories.append(path)
|
|
||||||
|
|
||||||
path = (settings_path / ".." / ".." / component_dir).resolve()
|
path = (settings_path / ".." / component_dir).resolve()
|
||||||
if path.is_dir():
|
if path.is_dir():
|
||||||
directories.append(path)
|
directories.append(path)
|
||||||
|
|
||||||
|
path = (settings_path / ".." / ".." / component_dir).resolve()
|
||||||
|
if path.is_dir():
|
||||||
|
directories.append(path)
|
||||||
|
|
||||||
return directories
|
return directories
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue