From: zuber Date: Tue, 18 Aug 2009 21:02:43 +0000 (+0200) Subject: IMAGE_DIR jest teraz relatywny do MEDIA_ROOT. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/620ca7a35fe42d7a1585c273ad463e0feacdf58b IMAGE_DIR jest teraz relatywny do MEDIA_ROOT. --- diff --git a/apps/explorer/models.py b/apps/explorer/models.py index 3b5848b7..5fa93ad6 100644 --- a/apps/explorer/models.py +++ b/apps/explorer/models.py @@ -4,11 +4,11 @@ from django.conf import settings def get_image_folders(): - return [fn for fn in os.listdir(settings.IMAGE_DIR) if not fn.startswith('.')] + return [fn for fn in os.listdir(os.path.join(settings.MEDIA_ROOT, settings.IMAGE_DIR)) if not fn.startswith('.')] def get_images_from_folder(folder): - return ['/media/images/' + folder + '/' + fn for fn - in os.listdir(os.path.join(settings.IMAGE_DIR, folder)) + return [settings.MEDIA_URL + settings.IMAGE_DIR + '/' + folder + '/' + fn for fn + in os.listdir(os.path.join(settings.MEDIA_ROOT, settings.IMAGE_DIR, folder)) if not fn.startswith('.')] diff --git a/project/settings.py b/project/settings.py index aad5a882..5632527f 100644 --- a/project/settings.py +++ b/project/settings.py @@ -105,7 +105,7 @@ INSTALLED_APPS = ( ) REPOSITORY_PATH = '/Users/zuber/Projekty/platforma/files/books' -IMAGE_DIR = '/Users/zuber/Projekty/platforma/files/images' +IMAGE_DIR = 'images' try: from localsettings import *