Tweaks to how upload paths are built

This commit is contained in:
Les Orchard 2011-10-09 17:18:45 -04:00
Родитель a242706cb8
Коммит 43c2981a75
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -3,6 +3,7 @@ import logging
from datetime import datetime, timedelta, tzinfo from datetime import datetime, timedelta, tzinfo
from time import time, gmtime, strftime from time import time, gmtime, strftime
import os.path
from os.path import dirname from os.path import dirname
from urlparse import urljoin from urlparse import urljoin
@ -57,9 +58,9 @@ DEFAULT_BADGE_IMAGE = getattr(settings, 'BADGER_DEFAULT_BADGE_IMAGE',
# Set up a file system for badge uploads that can be kept separate from the # Set up a file system for badge uploads that can be kept separate from the
# rest of /media if necessary. Lots of hackery to ensure sensible defaults. # rest of /media if necessary. Lots of hackery to ensure sensible defaults.
UPLOADS_ROOT = getattr(settings, 'BADGER_UPLOADS_ROOT', UPLOADS_ROOT = getattr(settings, 'BADGER_UPLOADS_ROOT',
'%suploads/' % getattr(settings, 'MEDIA_ROOT', 'media/')) os.path.join(getattr(settings, 'MEDIA_ROOT', 'media/'), 'uploads'))
UPLOADS_URL = getattr(settings, 'BADGER_UPLOADS_URL', UPLOADS_URL = getattr(settings, 'BADGER_UPLOADS_URL',
'%suploads/' % getattr(settings, 'MEDIA_URL', '/media/')) urljoin(getattr(settings, 'MEDIA_URL', '/media/'), 'uploads/'))
BADGE_UPLOADS_FS = FileSystemStorage(location=UPLOADS_ROOT, BADGE_UPLOADS_FS = FileSystemStorage(location=UPLOADS_ROOT,
base_url=UPLOADS_URL) base_url=UPLOADS_URL)