diff --git a/pinaxcon/settings.py b/pinaxcon/settings.py index b9870328a6cfbf1570427f4f9c20ee0255f3a6c5..67d3a695672d08f457ccb476c0f82033975eed50 100644 --- a/pinaxcon/settings.py +++ b/pinaxcon/settings.py @@ -60,10 +60,6 @@ USE_L10N = True # If you set this to False, Django will not use timezone-aware datetimes. USE_TZ = True -# Absolute filesystem path to the directory that will hold user-uploaded files. -# Example: "/home/media/media.lawrence.com/media/" -MEDIA_ROOT = os.path.join(PACKAGE_ROOT, "site_media", "media") - # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash. # Examples: "http://media.lawrence.com/media/", "http://example.com/media/" @@ -92,6 +88,15 @@ STATICFILES_FINDERS = [ "compressor.finders.CompressorFinder", ] +try: + _dynamic_storage_root = os.environ['DJANGO_DYNAMIC_STORAGE_ROOT'] +except KeyError: + # Absolute filesystem path to the directory that will hold user-uploaded files. + MEDIA_ROOT = os.path.join(PACKAGE_ROOT, "site_media", "media") +else: + MEDIA_ROOT = os.path.join(_dynamic_storage_root, "user_upload") + COMPRESS_ROOT = _dynamic_storage_root + # Make this unique, and don't share it with anybody. SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', '').strip() if (not SECRET_KEY) and DEBUG: