rf_django_envconfig¶
-
rf_django_envconfig.
get_bool
(env, name, default=False)[source]¶ Get a boolean value from the environment
If
name
is not found inenv
, returnTrue
ifdefault
evaluates toTrue
, otherwise returnFalse
.The following values are considered
False
:'False'
'false'
'Off'
'off'
'0'
'No'
'no'
''
Any other value is considered
True
.
-
rf_django_envconfig.
get_db_url
(env, name, default='')[source]¶ Get a
settings.DATABASES
entry from a URL in the environmentThis is just a thin convenience wrapper around dj-database-url.
If
name
is not found inenv
, return the result of parsingdefault
.DATABASES = { 'default': get_db_url( os.environ, 'DATABASE_URL', default='postgres://myuser:mypassword@localhost/myproject' ) }
-
rf_django_envconfig.
get_list
(env, name, default=None)[source]¶ Get a list from the environment
The input is assumed to be a comma-separated list of strings.
If
name
is not found inenv
, returndefault
. Note thatdefault
is returned as-is, so you should usually specify it as a list:ALLOWED_HOSTS = get_list(os.environ, 'ALLOWED_HOSTS', ['localhost', ])