From 97502fe130ad9788ff116d0ebd02825d81e512ae Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Fri, 8 Mar 2024 15:26:31 -0500 Subject: [PATCH] Define Media root and URL for uploaded/generated files --- .gitignore | 1 + cmsmanage/settings/base.py | 3 +++ cmsmanage/urls.py | 2 ++ 3 files changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index e4a0832..d07ba1a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ __pycache__/ *.sqlite3 /__pypackages__/ /markdownx/ +/media/ diff --git a/cmsmanage/settings/base.py b/cmsmanage/settings/base.py index 820faf9..b667e02 100644 --- a/cmsmanage/settings/base.py +++ b/cmsmanage/settings/base.py @@ -118,6 +118,9 @@ LOGGING = { }, } +MEDIA_ROOT = "media" +MEDIA_URL = "media/" + WIKI_URL = "https://wiki.claremontmakerspace.org" # Django Rest Framework diff --git a/cmsmanage/urls.py b/cmsmanage/urls.py index 0cd2fce..cc002cc 100644 --- a/cmsmanage/urls.py +++ b/cmsmanage/urls.py @@ -15,6 +15,7 @@ Including another URLconf """ from django.conf import settings +from django.conf.urls.static import static from django.contrib import admin from django.contrib.auth.views import LoginView, LogoutView from django.urls import include, path @@ -63,3 +64,4 @@ urlpatterns = [ if settings.DEBUG: urlpatterns.append(path("__debug__/", include("debug_toolbar.urls"))) + urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)