Settings

tangled.web.settings.make_app_settings(settings, conversion_map={}, defaults={}, required=(), prefix=None, strip_prefix=True, parse=True, section='app', **extra_settings)[source]

Create a properly initialized application settings dict.

In simple cases, you don’t need to call this directly–you can just pass a settings file name or a plain dict to tangled.web.app.Application, and this will be called for you.

If you need to do custom parsing (e.g., if your app has custom settings), you can call this function with a conversion map, defaults, &c. It’s a wrapper around parse_settings() that adds a bit of extra functionality:

  • A file name can be passed instead of a settings dict, in which case the settings will be extracted from the specified section of that file.
  • Core tangled.web defaults are always added because tangled.web.app.Application assumes they are always set.
  • Settings parsing can be disabled by passing parse=False. This only applies to your settings, including defaults and extra settings (core defaults are always parsed).
  • Extra settings can be passed as keyword args; they will override all other settings, and they will be parsed (or not) along with other settings.
  • Required settings are checked for after all the settings are merged.

In really special cases you can create a subclass of AAppSettings and then construct your settings dict by hand (eschewing the use of this function).