diff --git a/Readme.md b/Readme.md index 7d5c933d..a6af4680 100644 --- a/Readme.md +++ b/Readme.md @@ -26,4 +26,9 @@ git clone https://git.fet.at/bofh/fet2020 {{docker-compose.yml}} docker-compose up + + +Beim erstmaligen Erstellen der Thumbs für die Galerie soll dieser Command ausgeführt werden: + +python3 fet2020/manage.py create_thumbs \ No newline at end of file diff --git a/fet2020/gallery/management/__init__.py b/fet2020/gallery/management/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/fet2020/gallery/management/commands/__init__.py b/fet2020/gallery/management/commands/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/fet2020/gallery/management/commands/create_thumbs.py b/fet2020/gallery/management/commands/create_thumbs.py new file mode 100644 index 00000000..95da0b3a --- /dev/null +++ b/fet2020/gallery/management/commands/create_thumbs.py @@ -0,0 +1,19 @@ +import logging +import os + +from django.core.management.base import BaseCommand + +from gallery.utils import create_thumbs + + +logger = logging.getLogger(__name__) + +class Command(BaseCommand): + def handle(self, *args, **options): + _base_dir = "/home/project/fet2020/fet2020" + _path = "/files/uploads/gallery" + + folders = next(os.walk(_base_dir + _path))[1] + for folder in folders: + logger.info(f"Ordner {folder} wird bearbeitet.") + create_thumbs(folder)