summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-06-07 10:17:55 +0100
committerMatthew Lemon <y@yulqen.org>2024-06-07 10:17:55 +0100
commit76849342a720ea72e1afae6040445582dea3ae51 (patch)
treec8fc483b0b0e616dd64ba145ec45a36e589c384b
parent95d2528c8ec92e9ba153d6ed789ed603fa45c9a7 (diff)
Configures local dev to use sqlite and moves whitenoise middleware to prod settings
-rw-r--r--conf/settings/base.py1
-rw-r--r--conf/settings/local.py19
-rw-r--r--conf/settings/prod.py5
3 files changed, 18 insertions, 7 deletions
diff --git a/conf/settings/base.py b/conf/settings/base.py
index 0d7078a..ce622eb 100644
--- a/conf/settings/base.py
+++ b/conf/settings/base.py
@@ -65,7 +65,6 @@ INTERNAL_IPS = ["127.0.0.1", "localhost"]
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
- "whitenoise.middleware.WhiteNoiseMiddleware",
# "debug_toolbar.middleware.DebugToolbarMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
diff --git a/conf/settings/local.py b/conf/settings/local.py
index 0992726..fc42701 100644
--- a/conf/settings/local.py
+++ b/conf/settings/local.py
@@ -1,12 +1,19 @@
from .base import *
+# DATABASES = {
+# "default": {
+# "ENGINE": "django.db.backends.postgresql",
+# "NAME": "ded",
+# "USER": "ded",
+# "PASSWORD": "ded",
+# "HOST": "postgres",
+# "PORT": 5432,
+# }
+# }
+
DATABASES = {
"default": {
- "ENGINE": "django.db.backends.postgresql",
- "NAME": "ded",
- "USER": "ded",
- "PASSWORD": "ded",
- "HOST": "postgres",
- "PORT": 5432,
+ "ENGINE": "django.db.backends.sqlite3",
+ "NAME": "db.sqlite3",
}
}
diff --git a/conf/settings/prod.py b/conf/settings/prod.py
index 5b31337..3a3ada2 100644
--- a/conf/settings/prod.py
+++ b/conf/settings/prod.py
@@ -1,6 +1,7 @@
import os
from .base import *
+from .base import MIDDLEWARE
# Check if running in OpenShift cluster
if os.path.exists("/etc/secret-volume"):
@@ -31,4 +32,8 @@ DATABASES = {
}
}
+# this middleware entry must be in the correct position in the list
+# https://whitenoise.readthedocs.io/en/latest/#quickstart-for-django-apps
+MIDDLEWARE.insert(1, "whitenoise.middleware.WhiteNoiseMiddleware")
+
STATIC_ROOT = "/app/static"