def base_environment(self):
""" Convenience method for copying the environment to hand to batch jobs """
# Since we run django manage commands in the analysis container, it needs a copy of
# all the environment variables that this app needs, most of which are conveniently
# prefixed with 'PFB_'
# Set these first so they can be overridden by job specific settings below
environment = {key: val for (key, val) in os.environ.items()
if key.startswith('PFB_') and val is not None}
# For the ones without the 'PFB_' prefix, send the settings rather than the original
# environment variables because the environment variables might be None, which is not
# acceptable as a container override environment value, but the settings values will be set
# to whatever they default to in settings.
environment.update({
'DJANGO_ENV': settings.DJANGO_ENV,
'DJANGO_LOG_LEVEL': settings.DJANGO_LOG_LEVEL,
'AWS_DEFAULT_REGION': settings.AWS_REGION,
})
return environment
评论列表
文章目录