From 8feb1c1b720948cb5484376300450bf59b1ba0db Mon Sep 17 00:00:00 2001 From: Friedel Wolff Date: Thu, 18 Apr 2024 12:19:50 +0200 Subject: [PATCH] Configure MEDIA_ settings for uploads This ensures that all uploads (e.g. documents and logos) are separate from code, regardless of `upload_to` attributes on FileFields. This also allows a single volume to be mounted for all uploads that won't also contain other project files. --- .gitignore | 1 + app/app/settings.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index 0a5d310e..ec66bba8 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ env.bak/ venv.bak/ app/static_files/ /app/documents/ +app/media/ diff --git a/app/app/settings.py b/app/app/settings.py index 65fe49b3..e83f4752 100644 --- a/app/app/settings.py +++ b/app/app/settings.py @@ -125,6 +125,11 @@ USE_TZ = True +# Media files (uploads) + +MEDIA_ROOT = BASE_DIR / "media" +MEDIA_URL = "media/" + # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/5.0/howto/static-files/