-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix paths in base template, allow custom configuration. update README
- Loading branch information
EsGeh
authored and
EsGeh
committed
Nov 29, 2019
1 parent
6b1d7f6
commit 33f78f2
Showing
6 changed files
with
54 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
|
||
organisation = { | ||
'name' : "ORGANISATION NAME", | ||
'homepage' : "#" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from django.conf import settings # import the settings file | ||
|
||
from os import environ | ||
from pathlib import Path | ||
import sys | ||
from importlib import import_module | ||
import importlib.util | ||
|
||
|
||
def load_module( path, module_name ): | ||
spec = importlib.util.spec_from_file_location( | ||
module_name, | ||
path | ||
) | ||
module = importlib.util.module_from_spec(spec) | ||
spec.loader.exec_module( | ||
module | ||
) | ||
return module | ||
|
||
def custom_cfg(request): | ||
# return the value you want as a dictionnary. | ||
# The values will be added to the template context | ||
# for all templates: | ||
custom_config = load_module( | ||
Path(environ['RES_DIR']) / "custom_config/custom_config.py", | ||
"custom_config" | ||
) | ||
|
||
return { | ||
'organisation': custom_config.organisation | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters