Begin reimplementing compose
This commit is contained in:
@@ -13,6 +13,8 @@ https://docs.djangoproject.com/en/4.0/ref/settings/
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
TRUE_VALUES = {"1", "true", "yes", "on"}
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
@@ -36,8 +38,6 @@ INSTALLED_APPS = [
|
||||
"django.contrib.sessions",
|
||||
"django.contrib.messages",
|
||||
"django.contrib.staticfiles",
|
||||
"debug_toolbar",
|
||||
"template_profiler_panel",
|
||||
"django_htmx",
|
||||
"crispy_forms",
|
||||
"crispy_bulma",
|
||||
@@ -57,6 +57,16 @@ INSTALLED_APPS = [
|
||||
"cachalot",
|
||||
]
|
||||
|
||||
DEBUG_TOOLBAR_ENABLED = os.getenv("DEBUG_TOOLBAR_ENABLED", "false").lower() in TRUE_VALUES
|
||||
|
||||
if DEBUG_TOOLBAR_ENABLED:
|
||||
INSTALLED_APPS.extend(
|
||||
[
|
||||
"debug_toolbar",
|
||||
"template_profiler_panel",
|
||||
]
|
||||
)
|
||||
|
||||
# Performance optimisations
|
||||
CACHES = {
|
||||
"default": {
|
||||
@@ -81,7 +91,6 @@ CRISPY_ALLOWED_TEMPLATE_PACKS = ("bulma",)
|
||||
DJANGO_TABLES2_TEMPLATE = "django-tables2/bulma.html"
|
||||
|
||||
MIDDLEWARE = [
|
||||
"debug_toolbar.middleware.DebugToolbarMiddleware",
|
||||
"django.middleware.security.SecurityMiddleware",
|
||||
"django.contrib.sessions.middleware.SessionMiddleware",
|
||||
# 'django.middleware.cache.UpdateCacheMiddleware',
|
||||
@@ -95,6 +104,9 @@ MIDDLEWARE = [
|
||||
"django_htmx.middleware.HtmxMiddleware",
|
||||
]
|
||||
|
||||
if DEBUG_TOOLBAR_ENABLED:
|
||||
MIDDLEWARE.insert(0, "debug_toolbar.middleware.DebugToolbarMiddleware")
|
||||
|
||||
ROOT_URLCONF = "app.urls"
|
||||
ASGI_APPLICATION = "app.asgi.application"
|
||||
COMPOSE_WS_ENABLED = os.environ.get("COMPOSE_WS_ENABLED", "false").lower() in {
|
||||
@@ -104,20 +116,24 @@ COMPOSE_WS_ENABLED = os.environ.get("COMPOSE_WS_ENABLED", "false").lower() in {
|
||||
"on",
|
||||
}
|
||||
|
||||
TEMPLATE_CONTEXT_PROCESSORS = [
|
||||
"django.template.context_processors.request",
|
||||
"django.contrib.auth.context_processors.auth",
|
||||
"django.contrib.messages.context_processors.messages",
|
||||
"core.util.django_settings_export.settings_export",
|
||||
"core.context_processors.settings_hierarchy_nav",
|
||||
]
|
||||
|
||||
if DEBUG_TOOLBAR_ENABLED:
|
||||
TEMPLATE_CONTEXT_PROCESSORS.insert(0, "django.template.context_processors.debug")
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||
"DIRS": [os.path.join(BASE_DIR, "core/templates")],
|
||||
"APP_DIRS": True,
|
||||
"OPTIONS": {
|
||||
"context_processors": [
|
||||
"django.template.context_processors.debug",
|
||||
"django.template.context_processors.request",
|
||||
"django.contrib.auth.context_processors.auth",
|
||||
"django.contrib.messages.context_processors.messages",
|
||||
"core.util.django_settings_export.settings_export",
|
||||
"core.context_processors.settings_hierarchy_nav",
|
||||
],
|
||||
"context_processors": TEMPLATE_CONTEXT_PROCESSORS,
|
||||
},
|
||||
},
|
||||
]
|
||||
@@ -230,7 +246,7 @@ if PROFILER: # noqa - trust me its there
|
||||
|
||||
|
||||
def show_toolbar(request):
|
||||
return DEBUG # noqa: from local imports
|
||||
return DEBUG and DEBUG_TOOLBAR_ENABLED # noqa: from local imports
|
||||
|
||||
|
||||
DEBUG_TOOLBAR_CONFIG = {
|
||||
|
||||
Reference in New Issue
Block a user