mirror of
https://github.com/django-components/django-components.git
synced 2025-07-13 20:04:59 +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):
|
||||
component_dir = "components"
|
||||
directories = list(get_app_template_dirs(component_dir))
|
||||
settings_path = Path(*settings.SETTINGS_MODULE.split("."))
|
||||
|
||||
path = (settings_path / ".." / component_dir).resolve()
|
||||
if path.is_dir():
|
||||
directories.append(path)
|
||||
if settings.SETTINGS_MODULE:
|
||||
settings_path = Path(*settings.SETTINGS_MODULE.split("."))
|
||||
|
||||
path = (settings_path / ".." / ".." / component_dir).resolve()
|
||||
if path.is_dir():
|
||||
directories.append(path)
|
||||
path = (settings_path / ".." / component_dir).resolve()
|
||||
if path.is_dir():
|
||||
directories.append(path)
|
||||
|
||||
path = (settings_path / ".." / ".." / component_dir).resolve()
|
||||
if path.is_dir():
|
||||
directories.append(path)
|
||||
|
||||
return directories
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue