diff --git a/.jules/bolt.md b/.jules/bolt.md new file mode 100644 index 0000000..64fb160 --- /dev/null +++ b/.jules/bolt.md @@ -0,0 +1,3 @@ +## 2026-05-16 - Enabling Middleware-level Optimizations +**Learning:** For mostly static Django sites, enabling `GZipMiddleware` and `ConditionalGetMiddleware` provides significant performance gains (60-70% payload reduction and 304 support) with minimal configuration and risk. +**Action:** Always check if these middlewares are present in Django projects, as they are often omitted in default or minimal setups. diff --git a/config/settings.py b/config/settings.py index 28f1d9d..390c663 100644 --- a/config/settings.py +++ b/config/settings.py @@ -37,6 +37,12 @@ MIDDLEWARE = [ "django.middleware.security.SecurityMiddleware", + # ⚡ Bolt: Compress responses to reduce bandwidth usage. + # Expected impact: ~60-70% reduction in HTML payload size. + "django.middleware.gzip.GZipMiddleware", + # ⚡ Bolt: Support ETag/Last-Modified for conditional GET requests. + # Expected impact: Faster repeat visits by allowing 304 Not Modified responses. + "django.middleware.http.ConditionalGetMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", "django.middleware.common.CommonMiddleware", "django.middleware.csrf.CsrfViewMiddleware",