IMAGE_DIR jest teraz relatywny do MEDIA_ROOT.
authorzuber <marek@stepniowski.com>
Tue, 18 Aug 2009 21:02:43 +0000 (23:02 +0200)
committerzuber <marek@stepniowski.com>
Tue, 18 Aug 2009 21:02:43 +0000 (23:02 +0200)
apps/explorer/models.py
project/settings.py

index 3b5848b..5fa93ad 100644 (file)
@@ -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('.')]
 
index aad5a88..5632527 100644 (file)
@@ -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 *