Changeset - a72828efc7de
[Not reviewed]
0 1 0
Brett Smith - 5 years ago 2018-10-05 19:34:47
brettcsmith@brettcsmith.org
settings: Make root for dynamic storage configurable.
1 file changed with 9 insertions and 4 deletions:
0 comments (0 inline, 0 general)
pinaxcon/settings.py
Show inline comments
...
 
@@ -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:
0 comments (0 inline, 0 general)