add parsing of dict-string

STORAGE_CONFIG must be converted from string to a Dictionary, only if STORAGE_BACKEND is defined.
This commit is contained in:
Alessandro Gervaso 2020-06-22 11:41:14 +02:00 committed by GitHub
parent c75311c469
commit 3bbb65b2d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -208,7 +208,9 @@ STORAGE_BACKEND = os.environ.get('STORAGE_BACKEND', None)
# A dictionary of configuration parameters for the storage backend configured as STORAGE_BACKEND. The specific # A dictionary of configuration parameters for the storage backend configured as STORAGE_BACKEND. The specific
# parameters to be used here are specific to each backend; see the django-storages documentation for more detail. # parameters to be used here are specific to each backend; see the django-storages documentation for more detail.
# If STORAGE_BACKEND is not defined, this setting will be ignored. # If STORAGE_BACKEND is not defined, this setting will be ignored.
STORAGE_CONFIG = os.environ.get('STORAGE_CONFIG', None) if STORAGE_BACKEND:
import ast
STORAGE_CONFIG = ast.literal_eval(os.environ.get('STORAGE_CONFIG', "{}"))
# Time zone (default: UTC) # Time zone (default: UTC)
TIME_ZONE = os.environ.get('TIME_ZONE', 'UTC') TIME_ZONE = os.environ.get('TIME_ZONE', 'UTC')