API

Organize Django settings into multiple files and directories. Easily override and modify settings. Use wildcards and optional settings files.

class split_settings.tools._Optional[source]

Wrap a file path with this class to mark it as optional.

Optional paths don’t raise an IOError if file is not found.

split_settings.tools.optional(filename)[source]

This functions is used for compatibility reasons, it masks the old optional class with the name error. Now invalid-name is removed from pylint.

Parameters:filename – the filename to be optional

Returns: new instance of _Optional

split_settings.tools.include(*args, **kwargs)[source]

Used for including Django project settings from multiple files.

Usage:

from split_settings.tools import optional, include

include(
    'components/base.py',
    'components/database.py',
    optional('local_settings.py'),

    scope=globals()  # optional scope
)
Parameters:
  • *args – File paths (glob - compatible wildcards can be used)
  • **kwargs – The context for the settings, may contain scope=globals() or be empty
Raises:

IOError – if a required settings file is not found