From 48adb556a5a594394a38aa2e1600f98aaa849c45 Mon Sep 17 00:00:00 2001 From: Ekaropolus Date: Sun, 4 Jan 2026 15:50:23 -0600 Subject: [PATCH] Serving media --- polisplexity/settings.py | 1 + polisplexity/urls.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/polisplexity/settings.py b/polisplexity/settings.py index c4cda2b..4aaa41e 100644 --- a/polisplexity/settings.py +++ b/polisplexity/settings.py @@ -159,6 +159,7 @@ STATICFILES_DIRS = [ MEDIA_URL = "/media/" MEDIA_ROOT = BASE_DIR / "media" +SERVE_MEDIA = os.getenv("SERVE_MEDIA", "").lower() in ("1", "true", "yes") # Default primary key field type diff --git a/polisplexity/urls.py b/polisplexity/urls.py index 29a642e..8706c42 100644 --- a/polisplexity/urls.py +++ b/polisplexity/urls.py @@ -65,4 +65,6 @@ urlpatterns = [ if settings.DEBUG: urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) + +if settings.DEBUG or settings.SERVE_MEDIA: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)