magpie.constants

Constant settings for Magpie application.

Constants defined with format MAGPIE_[VARIABLE_NAME] can be matched with corresponding settings formatted as magpie.[variable_name] in the magpie.ini configuration file.

Note

Since the magpie.ini file has to be loaded by the application to retrieve various configuration settings, constant MAGPIE_INI_FILE_PATH (or any other path variable defined before it - see below) has to be defined by environment variable if the default location is not desired (ie: if you want to provide your own configuration).

Module Contents

magpie.constants.MAGPIE_MODULE_DIR[source]
magpie.constants.MAGPIE_ROOT[source]
magpie.constants.MAGPIE_CONFIG_DIR[source]
magpie.constants.MAGPIE_PROVIDERS_CONFIG_PATH[source]
magpie.constants.MAGPIE_PERMISSIONS_CONFIG_PATH[source]
magpie.constants.MAGPIE_INI_FILE_PATH[source]
magpie.constants.MAGPIE_ALEMBIC_INI_FILE_PATH[source]
magpie.constants.MAGPIE_ENV_DIR[source]
magpie.constants.MAGPIE_ENV_FILE[source]
magpie.constants.MAGPIE_POSTGRES_ENV_FILE[source]
magpie.constants.magpie_env_example[source]
magpie.constants.postgres_env_example[source]
magpie.constants._get_default_log_level()[source]

Get default configurations from ini file.

magpie.constants.MAGPIE_URL[source]
magpie.constants.MAGPIE_SECRET[source]
magpie.constants.MAGPIE_ADMIN_USER[source]
magpie.constants.MAGPIE_ADMIN_PASSWORD[source]
magpie.constants.MAGPIE_ADMIN_EMAIL[source]
magpie.constants.MAGPIE_ADMIN_GROUP[source]
magpie.constants.MAGPIE_ANONYMOUS_USER[source]
magpie.constants.MAGPIE_ANONYMOUS_PASSWORD[source]
magpie.constants.MAGPIE_ANONYMOUS_EMAIL[source]
magpie.constants.MAGPIE_ANONYMOUS_GROUP[source]
magpie.constants.MAGPIE_EDITOR_GROUP[source]
magpie.constants.MAGPIE_USERS_GROUP[source]
magpie.constants.MAGPIE_CRON_LOG[source]
magpie.constants.MAGPIE_DB_MIGRATION[source]
magpie.constants.MAGPIE_DB_MIGRATION_ATTEMPTS[source]
magpie.constants.MAGPIE_LOG_LEVEL[source]
magpie.constants.MAGPIE_LOG_PRINT[source]
magpie.constants.MAGPIE_LOG_REQUEST[source]
magpie.constants.MAGPIE_LOG_EXCEPTION[source]
magpie.constants.MAGPIE_UI_ENABLED[source]
magpie.constants.PHOENIX_USER[source]
magpie.constants.PHOENIX_PASSWORD[source]
magpie.constants.PHOENIX_HOST[source]
magpie.constants.PHOENIX_PORT[source]
magpie.constants.PHOENIX_PUSH[source]
magpie.constants.TWITCHER_PROTECTED_PATH[source]
magpie.constants.TWITCHER_PROTECTED_URL[source]
magpie.constants.MAGPIE_POSTGRES_USER[source]
magpie.constants.MAGPIE_POSTGRES_PASSWORD[source]
magpie.constants.MAGPIE_POSTGRES_HOST[source]
magpie.constants.MAGPIE_POSTGRES_PORT[source]
magpie.constants.MAGPIE_POSTGRES_DB[source]
magpie.constants.MAGPIE_ADMIN_PERMISSION = admin[source]
magpie.constants.MAGPIE_LOGGED_USER = current[source]
magpie.constants.MAGPIE_DEFAULT_PROVIDER = ziggurat[source]
magpie.constants.MAGPIE_USER_NAME_MAX_LENGTH = 64[source]
magpie.constants._REGEX_ASCII_ONLY[source]
magpie.constants.get_constant_setting_name(name)[source]

Lower-case name and replace all non-ascii chars by _.

magpie.constants.get_constant(constant_name, settings_container=None, settings_name=None, default_value=None, raise_missing=True, print_missing=False, raise_not_set=True) → SettingValue[source]
Search in order for matched value of constant_name:
  1. search in settings if specified
  2. search alternative setting names
  3. search in magpie.constants definitions
  4. search in environment variables

Parameter constant_name is expected to have the format MAGPIE_[VARIABLE_NAME] although any value can be passed to retrieve generic settings from all above mentioned search locations.

If settings_name is provided as alternative name, it is used as is to search for results if constant_name was not found. Otherwise, magpie.[variable_name] is used for additional search when the format MAGPIE_[VARIABLE_NAME] was used for constant_name (ie: MAGPIE_ADMIN_USER will also search for magpie.admin_user and so on for corresponding constants).

Parameters:
  • constant_name – key to search for a value
  • settings_container – wsgi app settings container
  • settings_name – alternative name for settings if specified
  • default_value – default value to be returned if not found anywhere, and exception raises are disabled.
  • raise_missing – raise exception if key is not found anywhere
  • print_missing – print message if key is not found anywhere, return None
  • raise_not_set – raise an exception if the found key is None, search until last case if previous are None
Returns:

found value or default_value

Raises:

according message based on options (by default raise missing/None value)