0 1 0
Brett Smith - 13 months ago 2019-09-30 15:20:19
brettcsmith@brettcsmith.org
settings: Make root for dynamic storage configurable.
1 file changed with 8 insertions and 4 deletions:
↑ Collapse Diff ↑
...
 
@@ -70,10 +70,6 @@ USE_L10N = True
70 70
 
# If you set this to False, Django will not use timezone-aware datetimes.
71 71
 
USE_TZ = True
72 72
 

	
73
 
# Absolute filesystem path to the directory that will hold user-uploaded files.
74
 
# Example: "/home/media/media.lawrence.com/media/"
75
 
MEDIA_ROOT = os.path.join(PACKAGE_ROOT, "site_media", "media")
76
 

	
77 73
 
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
78 74
 
# trailing slash.
79 75
 
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
...
 
@@ -109,6 +105,14 @@ AWS_ACCESS_KEY_ID = os.environ.get("DJANGO_AWS_ACCESS_KEY_ID", None)
109 105
 
AWS_SECRET_ACCESS_KEY = os.environ.get("DJANGO_AWS_SECRET_ACCESS_KEY", None)
110 106
 
AWS_STORAGE_BUCKET_NAME = os.environ.get("DJANGO_AWS_STORAGE_BUCKET_NAME", None)
111 107
 

	
108
 
try:
109
 
    _dynamic_storage_root = os.environ['DJANGO_DYNAMIC_STORAGE_ROOT']
110
 
except KeyError:
111
 
    # Absolute filesystem path to the directory that will hold user-uploaded files.
112
 
    MEDIA_ROOT = os.path.join(PACKAGE_ROOT, "site_media", "media")
113
 
else:
114
 
    MEDIA_ROOT = os.path.join(_dynamic_storage_root, "user_upload")
115
 
    COMPRESS_ROOT = _dynamic_storage_root
112 116
 

	
113 117
 
# Make this unique, and don't share it with anybody.
114 118
 
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', '').strip()
0 comments (0 inline, 0 general)