зеркало из https://github.com/mozilla/bedrock.git
Update CMS image-download script to make the appropriate expected target directories if they don't exist already
This commit is contained in:
Родитель
83a8df6cdc
Коммит
3f9eeee68b
|
@ -64,6 +64,16 @@ class Command(BaseCommand):
|
|||
image_key = f"media/cms/{image.file.name}"
|
||||
local_dest = build_path(settings.MEDIA_ROOT, image.file.name)
|
||||
|
||||
expected_output_dirs = [
|
||||
os.path.join(settings.MEDIA_ROOT, "original_images"),
|
||||
os.path.join(settings.MEDIA_ROOT, "images"),
|
||||
]
|
||||
|
||||
for dir_path in expected_output_dirs:
|
||||
if not os.path.exists(dir_path):
|
||||
self.stdout.write(f"setting up: {dir_path}\n")
|
||||
os.makedirs(dir_path)
|
||||
|
||||
if os.path.exists(local_dest) and not redownload:
|
||||
self.stdout.write(f"Skipping: {local_dest} already exists locally.\n")
|
||||
else:
|
||||
|
|
Загрузка…
Ссылка в новой задаче