import os import dfd real_settings = os.environ.get('REAL_DJANGO_SETTINGS') if real_settings: exec("from %s import *" % real_settings) else: raise ImportError static_in = dfd.get_path('static_in') build_static_in = dfd.get_path('build_static_in') static_out = dfd.get_path('static_out') secret_key_path = dfd.get_path_if_exists('secret_key') media_root_path = dfd.get_path_if_exists('persistent_media_root') DEBUG = bool(dfd.get_path_if_exists('debug_if_exists')) if secret_key_path: with open(secret_key_path) as secret_key_file: SECRET_KEY=secret_key_file.read() EXTENDED_STATICFILES_DIRS = [] for location in [l for l in [static_in, build_static_in] if os.path.exists(l)]: for filename in os.listdir(location): path = os.path.join(location, filename) if os.path.isdir(path):
import os import json import dfd extended_python_path = dfd.get_path_if_exists('extended_python_path') environment_path = dfd.get_path_if_exists('environment') if extended_python_path: import site site.addsitedir(extended_python_path) if environment_path: with open(environment_path) as env_file: new_env_vars = json.load(env_file) os.environ.update(new_env_vars) real_settings = os.environ.get('DJANGO_SETTINGS_MODULE') if real_settings is not None: os.environ['REAL_DJANGO_SETTINGS'] = real_settings os.environ['DJANGO_SETTINGS_MODULE'] = 'dfd_settings'
import os import dfd real_settings = os.environ.get('REAL_DJANGO_SETTINGS') if real_settings: exec("from %s import *" % real_settings) else: raise ImportError static_in = dfd.get_path_if_exists('static_in') build_static_in = dfd.get_path_if_exists('build_static_in') static_out = dfd.get_path_if_exists('static_out') secret_key_path = dfd.get_path_if_exists('secret_key') media_root_path = dfd.get_path_if_exists('persistent_media_root') if secret_key_path: with open(secret_key_path) as secret_key_file: SECRET_KEY = secret_key_file.read() EXTENDED_STATICFILES_DIRS = [] for location in [ l for l in [static_in, build_static_in] if l and os.path.exists(l) ]: for filename in os.listdir(location): path = os.path.join(location, filename) if os.path.isdir(path): EXTENDED_STATICFILES_DIRS.append(path)
import os import json import dfd extended_python_path = dfd.get_path_if_exists('extended_python_path') environment_path = dfd.get_path_if_exists('environment') if extended_python_path: import site site.addsitedir(extended_python_path) if environment_path: with open(environment_path) as env_file: new_env_vars = json.load(env_file) resolved_paths = {key: dfd.get_path(key) for key in dfd.paths} # this allows environment variables to be relative to named paths interpolated = {key: value.format(**resolved_paths) for key, value in new_env_vars.items()} os.environ.update(interpolated) real_settings = os.environ.get('DJANGO_SETTINGS_MODULE') if real_settings is not None: os.environ['REAL_DJANGO_SETTINGS'] = real_settings os.environ['DJANGO_SETTINGS_MODULE'] = 'dfd_settings'
import dfd real_settings = os.environ.get('REAL_DJANGO_SETTINGS') if real_settings: exec("from %s import *" % real_settings) else: raise ImportError static_in = dfd.get_path('static_in') build_static_in = dfd.get_path('build_static_in') static_out = dfd.get_path('static_out') secret_key_path = dfd.get_path_if_exists('secret_key') DEBUG = bool(dfd.get_path_if_exists('debug_if_exists')) if secret_key_path: with open(secret_key_path) as secret_key_file: SECRET_KEY=secret_key_file.read() EXTENDED_STATICFILES_DIRS = [] for location in [l for l in [static_in, build_static_in] if os.path.exists(l)]: for filename in os.listdir(location): path = os.path.join(location, filename) if os.path.isdir(path): EXTENDED_STATICFILES_DIRS.append(path)