diff --git a/badger/models.py b/badger/models.py index a898ae1..ac95a0a 100644 --- a/badger/models.py +++ b/badger/models.py @@ -3,6 +3,7 @@ import logging from datetime import datetime, timedelta, tzinfo from time import time, gmtime, strftime +import os.path from os.path import dirname 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 # rest of /media if necessary. Lots of hackery to ensure sensible defaults. 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', - '%suploads/' % getattr(settings, 'MEDIA_URL', '/media/')) + urljoin(getattr(settings, 'MEDIA_URL', '/media/'), 'uploads/')) BADGE_UPLOADS_FS = FileSystemStorage(location=UPLOADS_ROOT, base_url=UPLOADS_URL)