From e7f19110470e31f92cf26ee4791295c1e61a4c98 Mon Sep 17 00:00:00 2001 From: Stuart Leitch Date: Mon, 18 Mar 2024 15:13:22 +0000 Subject: [PATCH] [sftp] Add SFTP_BASE_URL setting (#1368) --- docs/backends/sftp.rst | 2 +- storages/backends/sftpstorage.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/backends/sftp.rst b/docs/backends/sftp.rst index 4de207df..159d8a10 100644 --- a/docs/backends/sftp.rst +++ b/docs/backends/sftp.rst @@ -117,7 +117,7 @@ Settings Absolute path of know host file, if it isn't set ``"~/.ssh/known_hosts"`` will be used. -``base_url`` +``base_url`` or ``SFTP_BASE_URL`` Default: Django ``MEDIA_URL`` setting diff --git a/storages/backends/sftpstorage.py b/storages/backends/sftpstorage.py index a7c9aebb..52d4d59b 100644 --- a/storages/backends/sftpstorage.py +++ b/storages/backends/sftpstorage.py @@ -49,7 +49,7 @@ def get_default_settings(self): "gid": setting("SFTP_STORAGE_GID"), "known_host_file": setting("SFTP_KNOWN_HOST_FILE"), "root_path": setting("SFTP_STORAGE_ROOT", ""), - "base_url": setting("MEDIA_URL"), + "base_url": setting("SFTP_BASE_URL") or setting("MEDIA_URL"), } def _connect(self):