refactor: Begin import of customisation app

This commit is contained in:
James Graham
2020-04-16 14:07:14 +01:00
parent 224a92f42e
commit 57c29bf01d
2 changed files with 28 additions and 1 deletions

View File

@@ -14,6 +14,8 @@ https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
""" """
import collections import collections
import logging
import logging.config
import pathlib import pathlib
from django.urls import reverse_lazy from django.urls import reverse_lazy
@@ -241,6 +243,12 @@ LOGGING = {
} }
} }
# Initialise logger now so we can use it in this file
LOGGING_CONFIG = None
logging.config.dictConfig(LOGGING)
logger = logging.getLogger(__name__)
# Admin panel variables # Admin panel variables
@@ -262,3 +270,20 @@ CONSTANCE_BACKEND = 'constance.backends.database.DatabaseBackend'
BOOTSTRAP4 = { BOOTSTRAP4 = {
'include_jquery': 'full', 'include_jquery': 'full',
} }
# Import customisation app settings if present
TEMPLATE_NAME_INDEX = 'index.html'
try:
from custom.settings import (
CUSTOMISATION_NAME,
TEMPLATE_NAME_INDEX
)
logger.info("Loaded customisation app: %s", CUSTOMISATION_NAME)
INSTALLED_APPS.append('custom')
except ImportError as e:
logger.info("No customisation app loaded: %s", e)

View File

@@ -4,8 +4,10 @@ Views belonging to the core of the project.
These views don't represent any of the models in the apps. These views don't represent any of the models in the apps.
""" """
from django.conf import settings
from django.views.generic import TemplateView from django.views.generic import TemplateView
class IndexView(TemplateView): class IndexView(TemplateView):
template_name = 'index.html' # Template set in Django settings file - may be customised by a customisation app
template_name = settings.TEMPLATE_NAME_INDEX