settings: Make root for dynamic storage configurable.
This commit is contained in:
parent
146377454d
commit
92a8613303
1 changed files with 8 additions and 4 deletions
|
@ -70,10 +70,6 @@ USE_L10N = True
|
||||||
# If you set this to False, Django will not use timezone-aware datetimes.
|
# If you set this to False, Django will not use timezone-aware datetimes.
|
||||||
USE_TZ = True
|
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
|
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
||||||
# trailing slash.
|
# trailing slash.
|
||||||
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
|
# 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)
|
||||||
AWS_SECRET_ACCESS_KEY = os.environ.get("DJANGO_AWS_SECRET_ACCESS_KEY", None)
|
AWS_SECRET_ACCESS_KEY = os.environ.get("DJANGO_AWS_SECRET_ACCESS_KEY", None)
|
||||||
AWS_STORAGE_BUCKET_NAME = os.environ.get("DJANGO_AWS_STORAGE_BUCKET_NAME", None)
|
AWS_STORAGE_BUCKET_NAME = os.environ.get("DJANGO_AWS_STORAGE_BUCKET_NAME", None)
|
||||||
|
|
||||||
|
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.
|
# Make this unique, and don't share it with anybody.
|
||||||
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', '').strip()
|
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', '').strip()
|
||||||
|
|
Loading…
Reference in a new issue