Define Media root and URL for uploaded/generated files

This commit is contained in:
Adam Goldsmith 2024-03-08 15:26:31 -05:00
parent 9c1771b414
commit 97502fe130
3 changed files with 6 additions and 0 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ __pycache__/
*.sqlite3 *.sqlite3
/__pypackages__/ /__pypackages__/
/markdownx/ /markdownx/
/media/

View File

@ -118,6 +118,9 @@ LOGGING = {
}, },
} }
MEDIA_ROOT = "media"
MEDIA_URL = "media/"
WIKI_URL = "https://wiki.claremontmakerspace.org" WIKI_URL = "https://wiki.claremontmakerspace.org"
# Django Rest Framework # Django Rest Framework

View File

@ -15,6 +15,7 @@ Including another URLconf
""" """
from django.conf import settings from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin from django.contrib import admin
from django.contrib.auth.views import LoginView, LogoutView from django.contrib.auth.views import LoginView, LogoutView
from django.urls import include, path from django.urls import include, path
@ -63,3 +64,4 @@ urlpatterns = [
if settings.DEBUG: if settings.DEBUG:
urlpatterns.append(path("__debug__/", include("debug_toolbar.urls"))) urlpatterns.append(path("__debug__/", include("debug_toolbar.urls")))
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)