Remove site_config file & add templates_local
This commit is contained in:
parent
8c11e02d9c
commit
e37c412fd9
9 changed files with 24 additions and 76 deletions
|
@ -1,20 +0,0 @@
|
|||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.cache import cache
|
||||
|
||||
|
||||
def site_config(request):
|
||||
config = cache.get('site_config')
|
||||
|
||||
if not config:
|
||||
config_path = Path(settings.BASE_DIR) / 'config' / 'site_config.json'
|
||||
try:
|
||||
with open(config_path, 'r') as f:
|
||||
config = json.load(f)
|
||||
cache.set('site_config', config, 3600)
|
||||
except FileNotFoundError:
|
||||
config = {}
|
||||
|
||||
return {'site_config': config}
|
Loading…
Add table
Add a link
Reference in a new issue