From 7963edfd306234eeca68bb6f330f587136b280ca Mon Sep 17 00:00:00 2001 From: FriggemannMichael Date: Tue, 7 Jul 2026 11:33:30 +0200 Subject: [PATCH] Add media file configuration Make MEDIA_URL and MEDIA_ROOT environment-driven (DJANGO_MEDIA_URL, DJANGO_MEDIA_ROOT) so uploaded offer images and profile files can be served under the deployment sub-path via the reverse proxy. --- core/settings.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/settings.py b/core/settings.py index cd14123..95e501a 100644 --- a/core/settings.py +++ b/core/settings.py @@ -172,6 +172,12 @@ def _env_list(name, default=''): STATIC_ROOT = BASE_DIR / 'staticfiles' +# Uploaded media (offer images, profile files). + +MEDIA_URL = os.environ.get('DJANGO_MEDIA_URL', 'media/') +MEDIA_ROOT = os.environ.get('DJANGO_MEDIA_ROOT') or BASE_DIR / 'media' + + # Deployment behind a reverse proxy (Nginx/Cloudflare) that terminates HTTPS. # FORCE_SCRIPT_NAME lets the app be served under a sub-path (e.g. /backend) so # reverse()-generated URLs include that prefix.