duck.settings.settings¶
Provides access to application settings.
Module Contents¶
Classes¶
A class for managing Duck settings. |
Functions¶
Combines default and user settings into a single dictionary. |
|
Converts a settings module to a dictionary. |
Data¶
API¶
- duck.settings.settings.SETTINGS: duck.settings.settings.Settings¶
‘get_combined_settings(…)’
- duck.settings.settings.SETTINGS_MODULE¶
‘get(…)’
- class duck.settings.settings.Settings¶
Bases:
dictA class for managing Duck settings.
This class extends the built-in
dictto store settings in a dictionary-like format. It also provides a custom representation of the settings for debugging and logging.Notes:
These settings can be altered at runtime once imported but the
SETTINGSshould be imported and edited at top level before importing anything related to Duck.Example:
from duck.settings import SETTINGS # Edit settings inplace .e.g., SETTINGS['ENABLE_HTTPS'] = True from duck.app import App app = App() if __name__ == '__main__': app.run()
Initialization
Initialize self. See help(type(self)) for accurate signature.
- __repr__()¶
- reload()¶
Re-execute the settings module and update this dict in-place.
… admonition:: Notes
The settings module will be the latest one set in
DUCK_SETTINGS_MODULE.
- source¶
None
The source of settings e.g.,
web.settings.
- duck.settings.settings.get_combined_settings() duck.settings.settings.Settings¶
Combines default and user settings into a single dictionary.
Reads the default settings from
duck.etc.settingsand attempts to read user settings from asettingsmodule in the current directory.- Returns:
Settings object derived from a dictionary containing the settings.
- Return type:
- Raises:
SettingsError – If there’s an error loading user settings.
- duck.settings.settings.settings_to_dict(settings_module: str) duck.settings.settings.Settings¶
Converts a settings module to a dictionary.
- Parameters:
settings_module – The path to the settings module.
- Returns:
Settings object derived from a dictionary containing the settings.
- Return type:
- Raises:
ImportError – If the settings module cannot be imported.